开发者

Conditional URL rewriting

开发者 https://www.devze.com 2022-12-21 04:42 出处:网络
How can I use URL rewriting in .htaccess to redirect to different domains depending on the URL? Examples:

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

精彩评论

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