Rewrite URL to index.php but avoid index.php in the URL

Posted by Tom on Stack Overflow See other posts from Stack Overflow or by Tom
Published on 2010-05-30T12:55:23Z Indexed on 2010/05/30 13:02 UTC
Read the original article Hit count: 226

I'm trying to internally redirect all requests to index.php and externally redirect all requests that contain index.php using a .htaccess file.

So URLs like http://host/test should be processed by index.php and URLs like http://host/index.php/test should be redirected to http://host/test and then processed by index.php (without redirecting the browser to index.php)

I tried the following but always get a message "Too many redirects...":

RewriteRule ^index\.php/?(.*)$ /$1 [R,L]
RewriteRule .* index.php/$0 [L]

© Stack Overflow or respective owner

Related posts about apache

Related posts about .htaccess