开发者

.htaccess RewriteCond question

I have this in my .htaccess:

Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_URI} !/includes
RewriteCond %{REQUEST_URI} !/images
RewriteRule (.*) index.php

It redirects all pages through index.php with the exception of the includes and images folder. Is this the correct way to use the exceptions? Also is there a way to use the exceptions on just one RewriteCond rule instead of each on a seperate line开发者_JS百科?


That is fine for the exceptions, though you could add a ^ inbetween the ! and / to make it says "starts with". As for combining them, you can do the following:

Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_URI} !/(includes|images)
RewriteRule (.*) index.php
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜