Example URL: -
- www.domain.com/index.php?bob
- www.domain.com/index.php?jane
- www.domain.com/index.php?fred
Need to rewrite as: -
- www.domain.com/bob
- www.domain.com/jane
- www.domain.com/fred
I tried with a lot of options, but closest I can get to: -
- www.domain.com/?bob
- www.domain.com/?jane
- www.domain.com/?fred
Below in .htaccess this is achieved ...
RewriteRule ^(.*)$ index.php?$1 [L,QSA]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s(.*)/index\.php [NC]
RewriteRule ^ %1 [R=301,L]
Please, can someone indicate what I need to change to the mailbox? (question mark) in the URL?
Edit
Just noticed that by applying the anubhava answer below, the robots.txt file, for example, does not allow the .txt file, but simply displays the main page.
.htaccess below: -
RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} \s/+index\.php\?([^\s&]+) [NC]
RewriteRule ^ %1? [R=301,L]
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteRule ^download/(.*) /index.php?route=error/not_found [L]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/?$ index.php?$1 [L,QSA] <--
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
< - pos1, URL- robots.txt 404 , .
< - line pos2, URL- robots.txt .
Edit2
robots.txt , Rewrite Base /: -
RewriteRule ^robots.txt - [L]