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>

1 Answer 1

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]
2
  • i added this but this doesnt works :(
    – Niresh
    Feb 6, 2014 at 20:06
  • Try this in a new browser.
    – anubhava
    Feb 6, 2014 at 20:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .