开发者

.htaccess RewriteCond question

开发者 https://www.devze.com 2023-01-30 00:14 出处:网络
I have this in my .htaccess: Options +FollowSymlinks RewriteEngine On RewriteCond %{REQUEST_URI} !/includes

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

精彩评论

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