URL redirect to another domain only for a specific URL

Using a single web hosting account to host multiple sites

URL redirect to another domain only for a specific URL

Postby Sean22 » Fri Nov 14, 2008 2:25 am

Hi All,

I'm struggling with the following issue.

I have one domain where I have a search application. What I wanted is anyone who clicks any of the search results should be redirected to another url which is located on another domain.

Basically anyone who clicks the url of the following type

http://search.com/sup/Emails/20080110/data/html/index-BE20060610303030.htm

should be redirected to the following url

http://newhost.com/cgi-bin/test.cgi?BE20060610303030


Below is what I tried

Code: Select all
RewriteCond %{HTTP_HOST} ^search\.com\/sup\/Emails\/ [NC]
RewriteRule ^(.*)$ http://newhost.com/cgi-bin/test.cgi?$1 [NC,L]


Please let me know whats the right way to do this.

Regards
Sean
Sean22
 
Posts: 4
Joined: Fri Nov 14, 2008 2:15 am

Postby richardk » Fri Nov 14, 2008 12:59 pm

HTTP_HOST is the domain name only. Try
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{HTTP_HOST} ^(www\.)?example1\.com$ [NC]
RewriteRule ^sup/Emails/20080110/data/html/index-([a-z0-9]+)\.htm$ http://example2.com/cgi-bin/test.cgi?$1 [NC,R=301,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Thank you

Postby Sean22 » Sat Nov 15, 2008 4:08 am

Thank you Richard

It works perfectly..

Regards
Sean
Sean22
 
Posts: 4
Joined: Fri Nov 14, 2008 2:15 am


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 23 guests

cron