1,105,232 Community Members

RewriteRule For New Domain

Member Avatar
PaliGap
Newbie Poster
11 posts since May 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

I need a rewrite rule to change requests for a specific script on one domain and sub-domain to another domain and path:

http://domain-one.com/cgi-bin/38837728.cgi
or
http://www.domain-one.com/cgi-bin/38837728.cgi

to
http://somwhere-else.net/cgi-bin/abc/38837728.cgi

I have other domains that share the same script directory as domain-one.com and www.domain.com. But I only want to redirect requests for domain-one.com and www.domain.com, not anything else!

Thanks in advance.

Member Avatar
james.newell
Light Poster
33 posts since Mar 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 3 [?]
Skill Endorsements: 0 [?]
 
1
 
RewriteEngine On
RewriteCond %{HTTP_HOST} domain-one\.com$ [NC]
RewriteRule ^cgi-bin/38837728.cgi$ http://somwhere-else.net/cgi-bin/abc/38837728.cgi [L,R=301]

That should be pretty close.

Member Avatar
james.newell
Light Poster
33 posts since Mar 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 3 [?]
Skill Endorsements: 0 [?]
 
0
 
RewriteEngine On
RewriteCond %{HTTP_HOST} domain-one\.com$ [NC]
RewriteRule ^cgi-bin/38837728.cgi$ http://somwhere-else.net/cgi-bin/abc/38837728.cgi [L,R=301]

That should be pretty close.

manojsamtani
Light Poster
37 posts since Apr 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
Banned
 
0
 

Ya james is right but need to add one more RewriteCond:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain-one\.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.domain-one\.com$ [NC]
RewriteRule ^cgi-bin/38837728.cgi$ http://somwhere-else.net/cgi-bin/abc/38837728.cgi [L,R=301]

I think, this will solve your rewrite rule problem.

---
Manoj

Member Avatar
farooqwani19
Newbie Poster
2 posts since Apr 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

That is when you resolve the domain with www. if it is without www, just put vice versa.

manojsamtani
Light Poster
37 posts since Apr 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
Banned
 
0
 

Please read the question again :) its for with www!!!

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: