Ash Machine
Ash Machine

Reputation: 9901

Help with htaccess redirect rewrite rule

I want to use Helicon ISAPI Rewrite to redirect an old URL to a new URL, but only within a virtual directory named colors:

http://www.mydomain.com/colors/default.aspx?id=blue

needs to redirect to

http://www.newdomain.org/colors/default.aspx?id=blue

I am new to this and cannot find an appropriate example, so any help would be appreciated.

Upvotes: 0

Views: 570

Answers (2)

TonyCool
TonyCool

Reputation: 1004

Here's another possibility:

RewriteBase /
RewriteCond %{HTTP_HOST} ^(?:www\.)?mydomain\.com$ [NC]
RewriteRule ^(colors/.*)$ http://www.newdomain.org/$1 [NC,R=301,L]

Upvotes: 0

Jim Puls
Jim Puls

Reputation: 81052

Helicon ISAPI Rewrite appears to share mod_rewrite's syntax, so:

RewriteCond %{HTTP_HOST} www\.mydomain\.com
RewriteCond %{HTTP_URL} ^/colors
RewriteRule ^(.*)$ http://www.newdomain.org/$1 [R]

Upvotes: 1

Related Questions