开发者

How point multiple directories in htaccess using if else condition in htaccess?

开发者 https://www.devze.com 2023-01-25 10:01 出处:网络
I want to point multiple directory using the htaccess. suppose i have two directory AAA and BBB. if ( in url \"AAA\" is present ) point directory AAA;

I want to point multiple directory using the htaccess.

suppose i have two directory AAA and BBB.

if ( in url "AAA" is present ) point directory AAA; else Point director开发者_C百科y BBB.

Is it possible ??


Is this what you mean?

# make sure mod_rewrite is on
RewriteEngine On

# check request URI for AAA and rewrite to /AAA/ (only once)
RewriteCond %{REQUEST_URI} !^/AAA.*
RewriteRule (.*)           /AAA/$1   [L]

# otherwise rewrite to /BBB/
RewriteRule (.*)           /BBB/$1

Also, you might want to try:

RewriteCond %{REQUEST_URI} ^[^A]+AAA.*

instead of the first line, as I can't remember if they're a / at the front of RewriteRules or not...

0

精彩评论

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