[英]Using HELICON ISAPI Rewrite & ASP.Net MVC - Url Redirection
I am using IIS and HELICON ISAPI rewrite. 我正在使用IIS和HELICON ISAPI重写。
My Requirement: Redirect 1 market specific sites to new domain. 我的要求:将1个特定于市场的站点重定向到新域。
ex: www.example.com/anz -> www.example2.com/anz (should redirect) 例如:www.example.com/anz-> www.example2.com/anz(应重定向)
www.example.com/deu -> www.example.com/deu (should not redirect) www.example.com/deu-> www.example.com/deu(不应重定向)
I tried: 我试过了:
RewriteCond %{HTTP_HOST} ^example.com [NC] RewriteCond%{HTTP_HOST} ^ example.com [NC]
RewriteRule ^(.*)$ https://example2.com/ $1 [L,R=302] RewriteRule ^(。*)$ https://example2.com/ $ 1 [L,R = 302]
It redirects, but both the markets. 它重定向,但两个市场。
and again with 并再次
RewriteCond %{HTTP_HOST} ^example.com/anz [NC] RewriteCond%{HTTP_HOST} ^ example.com / anz [NC]
RewriteRule ^(.*)$ www.example2.com/anz/$1 [L,R=302] RewriteRule ^(。*)$ www.example2.com/anz/$1 [L,R = 302]
failed to redirect. 重定向失败。
and again with escape sequence character 并再次使用转义序列字符
RewriteCond %{HTTP_HOST} ^example.com\\/anz [NC] RewriteCond%{HTTP_HOST} ^ example.com \\ / anz [NC]
RewriteRule ^(.*)$ https://example2.com/anz/ $1 [L,R=302] RewriteRule ^(。*)$ https://example2.com/anz/ $ 1 [L,R = 302]
failed to redirect. 重定向失败。
Please help me. 请帮我。
Please try: 请试试:
RewriteCond %{HTTP_HOST} ^(www\.)?example.com [NC]
RewriteRule ^/?(anz.*)$ https\://www.example2.com/$1 [L,R=302]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.