Redirect every index.php to his root folder
I'd like to know the RewriteRule
to redirect(301)
every index.php
to their root.
For example, this url:
http://www.example.com/folder/index.php
is redirected to:
http://www.example.com/folder/
I need a generic rule to avoid .htaccess
edit for each new开发者_开发问答 folder.
.htaccess
will be placed on the root of the website.RewriteEngine On
RewriteRule ^(.*)/?index\.php(\?*.*)$ $1/$2 [L,R=301]
This should take /anyfolder/another/folder/index.php?a=1
and rewrite it to /anyfolder/another/folder/?a=1
(GET variables optional, of course.)
精彩评论