开发者

Htaccess - RewriteCond: only php as file extension

I want to apply a rewrite condition, so that only *.php fil开发者_如何学Ces are affected:

Options +FollowSymLinks
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} /.php$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /example.php [L]

The first condition here does not seem to work for files inside a directory like www.test.com/test/example.php (only for www.test.com/example.php).

Thanks for help.


Try this code instead:

Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^[^\.]+\.php$ /example.php [L,NC]
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜