Htaccess rewrite rule delete question mark

Let's say I have the following url:

http://example.com/?param

how to remove a question mark from a url i.e. rewrite

http://example.com/param

like that:

http://example.com/index.php?param

Here is my code that does not work:

RewriteEngine On
RewriteRule ^(.*)$ /index.php?$1 [P]
+1
source share
1 answer

. , - URL. -, , . URL- , . , , , .

URL-:

RewriteEngine On
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(index\.php)?\?([^&\ ]+)
RewriteRule ^ /%1? [L,R=301]

URL-: http://example.com/?something URL-: http://example.com/something

:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?$1 [L]

http://example.com/something, URI /index.php?something. , URL http://example.com/something, URI /index.php?something.

+3

All Articles