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



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.

Recommended Answers

All 5 Replies

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.


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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.