I am using the Kohana framework (but I think it doesn't matter for this question) and the pages can be accessed like this
http://www.example.com/articles/
http://www.example.com/index.php/articles/
Now, as a rule, I usually try to configure my .htaccess to allow only one path for the page and quietly redirect to other common ways.
Essentially, in the first URL, the address is actually redirected to the second example.
What I want to do is make all the URLs of the second type turn into URLs of the first type. I'm not often sure about .htaccess, and my first attempt throws unexpected results (like endless loops)
Here is what I came up with
RewriteRule ^index\.php/(.*) $1 [NC,L,R=301]
Can someone tell me what I'm doing wrong, and if you encounter this problem, how did you solve it?
EDIT
.htaccess, .
RewriteEngine On
RewriteBase /~toberua/
ErrorDocument 404 /404/
ErrorDocument 403 /403/
Options -Indexes
DirectoryIndex index.php
RewriteRule ^(([a-z0-9\-]+/)*[a-z0-9\-]+)$ $1/ [NC,R=301,L]
RewriteCond %{REQUEST_URI} !^/images/layout/favicon\.ico [NC]
RewriteCond %{REQUEST_URI} favicon\.(gif|ico|png|jpe?g) [NC]
RewriteRule (.*) images/layout/favicon.ico [R=301,L]
RewriteRule home/ $1 [NC,R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php\ HTTP/
RewriteRule ^(.*)index\.php$ $1 [R=301,L] # this was my attempt to stop /dir/index.php and make it simply /dir/
RewriteRule ^index\.php/(.*) $1 [NS,NC,L,R=301]
RewriteRule ^(application|modules|system) - [F,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]