开发者

Mod Rewrite allow one directory redirect all other traffic

I have a domain which is currently redirecting all traffic to another domain but I want to set up a sub directory on the first domain and allow traffic to that sub directory while continuing to redirect all other traffic. The rewrite directives currently in use are as follows:

RewriteEngine on

RewriteCond %{HTTP_HOST} ^firstdomain.com.au$ [OR]
RewriteCond %{HTTP_HOST} ^www.firstdomain.com.au$
RewriteRule ^(.*)$ "http\:\/\/www\.seconddomain\.com\/$1" [R=301,L]

I want to be开发者_运维百科 able to access anything in a subdirectory www.firstdomain.com.au/wp/

Is there a simple solution? Thanks in advance.


Try this rule in your .htaccess file:

Options +FollowSymlinks -MultiViews
RewriteEngine on

RewriteCond %{HTTP_HOST} ^(www\.)?firstdomain\.com\.au$ [NC]
RewriteCond %{REQUEST_URI} !^/wp/ [NC]
RewriteRule ^(.*)$ http://www.seconddomain.com/$1 [R=301,L]
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜