ram
ram

Reputation: 15

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.

Upvotes: 0

Views: 396

Answers (1)

Yaroslav
Yaroslav

Reputation: 1271

Please try:

RewriteCond %{HTTP_HOST} ^(www\.)?example.com [NC]    
RewriteRule ^/?(anz.*)$ https\://www.example2.com/$1 [L,R=302]

Upvotes: 0

Related Questions