Nick Nick - 1 year ago 114
Apache Configuration Question

htaccess remove index.php from url

I have a problem whereby google has indexed some pages with the wrong url.

The url they are indexing is:

I need it to redirect to:

.htaccess isn't my forte, so any help would be much appreciated.

Thanks in advance.

Answer Source

This is the basic rule to hide index.php from the URL. Put this in your root .htaccess file.

mod_rewrite must be enabled with PHP and this will work for the PHP version higher than 5.2.6.

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