I am a little afraid to post this, but I'm running into an issue and haven't found a solution yet. I've been able to successfully remove the "index.php" from all my URLs, however I'm still finding that if I manually add "index.php" to any URL, I can still view the page and am not redirected to a URL without "index.php". For example:
http://domain.com/events/
Works just fine, but if I visit http://domain.com/index.php/events/
I can still view the page. Any idea on how to force it to redirect me to just http://domain.com/events/
?
Here's my .htaccess file for reference:
# ----------------------------------------------------------------------
# Remove index.php from URLs
# ----------------------------------------------------------------------
<IfModule mod_rewrite.c>
RewriteEngine On
# Force trailing slash
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*[^/])$ /$1/ [L,R=301]
# Force www
RewriteCond %{HTTP_HOST} =domain.com [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]
# Send would-be 404 requests to Craft
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]
RewriteRule (.+) index.php?p=$1 [QSA,L]
</IfModule>
Is this even possible with Craft? Thanks in advance!