remove the question mark from url using htaccess

0

i have tried to remove the index.php from url but the problem is I'm seeing an ugly question mark in the beginning of the url how can i get rid of it

This is the code i have used in htaccess

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule \.(jpeg|jpg|gif|png)$ /public/404.php [NC,L]

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

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*) /index.php?q=$1
</IfModule>

The KingMaker

Posted 2014-02-06T17:54:44.717

Reputation: 103

Answers

0

Replace your 301 rule with this for removing index.php:

RewriteCond %{THE_REQUEST} /index\.php [NC]
RewriteRule ^(.*?)index\.php$ /$1 [L,R=301,NC,NE]

anubhava

Posted 2014-02-06T17:54:44.717

Reputation: 930

i added this but this doesnt works :( – The KingMaker – 2014-02-06T20:06:35.883

Try this in a new browser. – anubhava – 2014-02-06T20:07:23.063