开发者

htaccess redirection exceptions

开发者 https://www.devze.com 2023-01-31 21:33 出处:网络
i have the following .htaccess RewriteEngine On RewriteRule ^([a-zA-Z0-9_-]+)/$ index.php?type=Navigation&action=$1

i have the following .htaccess

RewriteEngine On

RewriteRule ^([a-zA-Z0-9_-]+)/$ index.php?type=Navigation&action=$1
RewriteRule ^([a-zA-Z0-9_-]+)$ index.php?type=Navigation&action=$1

Options All -Indexes

which sends everything to index.php in the root folder. But in my structure i have something like

/root
   /.htaccess
   /index.php
   /files
   /intranet

i was wondering if there is a RewriteRule exception so that when i type www.mysite.com/int开发者_开发知识库ranet it goes to the 'intranet' folder without passing trough the index.php file

thanks!


Yes. I believe you just put a rule before the others with the url you do not want rewritten, and specify that it shouldn't be rewritten using - like so:

RewriteRule ^intranet/.*$ - [L]


RewriteCond %{REQUEST_URI} ^\/intranet\/?
RewriteRule ^([a-zA-Z0-9_-]+)\/?$ index.php?type=Navigation&action=$1 [L]

Will do the trick.

0

精彩评论

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