Redirect index.php in CodeIgniter
- by Gabriel Bianconi
Hello.
I created a CodeIgniter application and now I'm trying to redirect the urls with index.php to urls without it.
My current .htaccess is:
RewriteEngine On
RewriteBase /
# Removes trailing slashes (prevents SEO duplicate content issues)
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ $1 [L,R=301]
# Enforce www
# If you have subdomains, you can add them to
# the list using the "|" (OR) regex operator
RewriteCond %{HTTP_HOST} !^(www|subdomain) [NC]
RewriteRule ^(.*)$ http://www.plugb.com/$1 [L,R=301]
# Checks to see if the user is attempting to access a valid file,
# such as an image or css document, if this isn't true it sends the
# request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
The only problem is that the same page is accessible with and without the index.php.
For example:
http://www.plugb.com/index.php/games/adventure-rpg
and
http://www.plugb.com/games/adventure-rpg
Is there a way to redirect the index.php URLs?
Thank you,
Gabriel.