开发者

htaccess mod rewrite NOT

开发者 https://www.devze.com 2022-12-27 03:13 出处:网络
I have a small problem with url rewriting on apache. 开发者_如何学CI would like it that it ignores the admin/ folder from rewriting.

I have a small problem with url rewriting on apache.

开发者_如何学CI would like it that it ignores the admin/ folder from rewriting.

 Options +FollowSymLinks
 RewriteRule ^([^/]*)/([^/]*)\.html$ /index.php?cat=$1&name=$2 [L]
 RewriteRule ^([^/]*)/$ /index.php?cat=$1 [L]

I have triend doing it myself but I can't figure it out.

Thanks.


You can use RewriteCond to put conditions on a RewriteRule. Unless all of the conditions match, the RewriteRule won't be applied. In your case, I'll assume your admin folder is located at http://yoursite.com/admin, so a rule like this should work:

RewriteCond %{REQUEST_URI} !^/admin/*

Put that before the RewriteRule that you want to prevent from being applied. The order of RewriteCond and RewriteRule directives is important, so be sure of where you're putting it.


I think this may be more of a ServerFault thing, but there's a really quick answer: if you put

RewriteRule ^admin/ - [L]

before your other rewriting rules, that should prevent any URL transformations from being applied to URLs starting with admin/.

0

精彩评论

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