简体   繁体   中英

Using HELICON ISAPI Rewrite & ASP.Net MVC - Url Redirection

I am using IIS and HELICON ISAPI rewrite.

My Requirement: Redirect 1 market specific sites to new domain.

ex: www.example.com/anz -> www.example2.com/anz (should redirect)
www.example.com/deu -> www.example.com/deu (should not redirect)

I tried:

RewriteCond %{HTTP_HOST} ^example.com [NC]

RewriteRule ^(.*)$ https://example2.com/ $1 [L,R=302]

It redirects, but both the markets.

and again with

RewriteCond %{HTTP_HOST} ^example.com/anz [NC]

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]

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]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM