开发者

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.

The .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.)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜