开发者

Conditional URL rewriting

How can I use URL rewriting in .htaccess to redirect to different domains depending on the URL?

Examples:

  • http://ON开发者_Go百科E/ to http://TWO/
  • http://ONE/some_content to http://THREE/some_content


This ought to work if you want to redirect the client:

# http://ONE/ to http://TWO/
RewriteCond %{HTTP_HOST}    =one
RewriteRule ^$             http://two/ [R,L]

# http://ONE/some_content to http://THREE/some_content
RewriteCond %{HTTP_HOST}    =one
RewriteRule ^(.+)$         http://three/$1 [R,L]

If you prefer to proxy the requests, change the R flag to a P instead.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜