subdomain pass through
am 24.09.2007 16:53:39 von MWE Computer Services
Recently we migrated an entire development/internal domain to fully
qualified external domain name. We have already updated the DNS for
both the old site to point to our redirect server and new site domain
location. The problem we have now is that we cannot redirect from the
old subdomain.domain.com name to the new subdomain.newdomain.com one.
We are running Apache 1.3.37 on HP-UX 11.23 with mod_alias and
mod_rewrite available.
This is what is needed to happen: site1.domain.com -->
site1.newdomain.com
I wrote the following out as per our virthosts-redirect.conf file on
the redirect server:
ServerName domain.com
ServerAlias www.domain.com
ServerAlias *.domain.com
CustomLog /dev/null common
ErrorLog /dev/null
RewriteEngine On
RewriteCond %{HTTP_HOST} ^([^.]+)\.domain\.com$ [NC]
RewriteRule ^(.*)$ http://%1.newdomain.com [L]
Is there a way to divert all subdomain names from the old site and
pass it on the the new site keeping the subdomain name intact?
-- Michael
Re: subdomain pass through
am 24.09.2007 18:35:50 von phantom
"MWE Computer Services" wrote in message
news:1190645619.706242.269750@19g2000hsx.googlegroups.com...
> Recently we migrated an entire development/internal domain to fully
> qualified external domain name. We have already updated the DNS for
> both the old site to point to our redirect server and new site domain
> location. The problem we have now is that we cannot redirect from the
> old subdomain.domain.com name to the new subdomain.newdomain.com one.
>
> We are running Apache 1.3.37 on HP-UX 11.23 with mod_alias and
> mod_rewrite available.
>
> This is what is needed to happen: site1.domain.com -->
> site1.newdomain.com
>
> I wrote the following out as per our virthosts-redirect.conf file on
> the redirect server:
>
>
> ServerName domain.com
> ServerAlias www.domain.com
> ServerAlias *.domain.com
> CustomLog /dev/null common
> ErrorLog /dev/null
>
> RewriteEngine On
> RewriteCond %{HTTP_HOST} ^([^.]+)\.domain\.com$ [NC]
maybe ([^.]+) should be ([^\.]+)
or, you might just want to remove the rewrite cond completely?
> RewriteRule ^(.*)$ http://%1.newdomain.com [L]
not sure what you're doing here, although %1 should be $1 and unfortunately
the left hand side is only matching on REQUEST_URI (for
http://site1.domain.com/ this will be '/')
>
>
> Is there a way to divert all subdomain names from the old site and
> pass it on the the new site keeping the subdomain name intact?
>
A small php script would work, I'm not aware of any way to do this in an
apache 1.3 config.
If you were using apache 2.0.51 or above you could probably use SetEnvIf to
achieve what you are trying to do
http://httpd.apache.org/docs/2.2/mod/mod_setenvif.html#seten vif
Re: subdomain pass through
am 26.09.2007 12:09:38 von sean dreilinger
MWE Computer Services wrote:
> Recently we migrated an entire development/internal domain to fully
> qualified external domain name. We have already updated the DNS for
> both the old site to point to our redirect server and new site domain
> location. The problem we have now is that we cannot redirect from the
> old subdomain.domain.com name to the new subdomain.newdomain.com one.
>
> We are running Apache 1.3.37 on HP-UX 11.23 with mod_alias and
> mod_rewrite available.
>
> This is what is needed to happen: site1.domain.com -->
> site1.newdomain.com
if the "old.com" domain has its own IP address (1.3.5.7) to which all of the
"old.com" websites are pointed, you could use an IP-based virtualhost to catch
and redirect all of the *.old.com traffic, without preconfiguring any serveraliases:
servername redirect.old.com
rewriteengine on
rewritecond %{HTTP_HOST} ^([^.]+)\.old\.com$ [nocase]
rewriterule ^(.*)$ http://%1.new.com$1 [last, redirect=permanent]
... [ other config requirements - logging, etc. ]
if everything, old and new, is stuck pointing at just one ip address that must
be shared among all virtualhosts and both domains, you can skip the separate
redirect host and adjust each virtualhost stanza in the apache configuration to
field traffic for either hostname (old or new)---but redirect guests arriving at
the "old.com" subdomains to the preferred (canonical) hostname immediately.
here's some pseudocode that would apply:
servername sub1.new.com
serveralias sub1.old.com
rewriteengine on
rewritecond %{HTTP_HOST} !^$
rewritecond %{HTTP_HOST} !^sub1\.new\.com [nocase]
rewriterule ^(.*)$ http://sub1.new.com$1 [last, redirect=permanent]
... [ other config requirements - logging, etc. ]
servername sub2.new.com
serveralias sub2.old.com
rewriteengine on
rewritecond %{HTTP_HOST} !^$
rewritecond %{HTTP_HOST} !^sub2\.new\.com [nocase]
rewriterule ^(.*)$ http://sub2.new.com$1 [last, redirect=permanent]
... [ other config requirements - logging, etc. ]
....
servername subN.new.com
serveralias subN.old.com
rewriteengine on
rewritecond %{HTTP_HOST} !^$
rewritecond %{HTTP_HOST} !^subN\.new\.com [nocase]
rewriterule ^(.*)$ http://subN.new.com$1 [last, redirect=permanent]
... [ other config requirements - logging, etc. ]
there is a section in the apache 1.3 url rewriting guide that covers this
scenario, its called "canonical hostnames".
http://httpd.apache.org/docs/1.3/misc/rewriteguide.html
--sean
--
sean dreilinger - http://durak.org/sean/
Re: subdomain pass through
am 26.09.2007 16:02:31 von MWE Computer Services
On Sep 26, 6:09 am, sean dreilinger wrote:
> MWE Computer Services wrote:
> > Recently we migrated an entire development/internal domain to fully
> > qualified external domain name. We have already updated the DNS for
> > both the old site to point to our redirect server and new site domain
> > location. The problem we have now is that we cannot redirect from the
> > old subdomain.domain.com name to the new subdomain.newdomain.com one.
>
> > We are running Apache 1.3.37 on HP-UX 11.23 with mod_alias and
> > mod_rewrite available.
>
> > This is what is needed to happen: site1.domain.com -->
> > site1.newdomain.com
>
> if the "old.com" domain has its own IP address (1.3.5.7) to which all of the
> "old.com" websites are pointed, you could use an IP-based virtualhost to catch
> and redirect all of the *.old.com traffic, without preconfiguring any serveraliases:
>
>
> servername redirect.old.com
> rewriteengine on
> rewritecond %{HTTP_HOST} ^([^.]+)\.old\.com$ [nocase]
> rewriterule ^(.*)$ http://%1.new.com$1 [last, redirect=permanent]
> ... [ other config requirements - logging, etc. ]
>
>
> if everything, old and new, is stuck pointing at just one ip address that must
> be shared among all virtualhosts and both domains, you can skip the separate
> redirect host and adjust each virtualhost stanza in the apache configuration to
> field traffic for either hostname (old or new)---but redirect guests arriving at
> the "old.com" subdomains to the preferred (canonical) hostname immediately.
> here's some pseudocode that would apply:
>
>
> servername sub1.new.com
> serveralias sub1.old.com
> rewriteengine on
> rewritecond %{HTTP_HOST} !^$
> rewritecond %{HTTP_HOST} !^sub1\.new\.com [nocase]
> rewriterule ^(.*)$http://sub1.new.com$1[last, redirect=permanent]
> ... [ other config requirements - logging, etc. ]
>
>
>
> servername sub2.new.com
> serveralias sub2.old.com
> rewriteengine on
> rewritecond %{HTTP_HOST} !^$
> rewritecond %{HTTP_HOST} !^sub2\.new\.com [nocase]
> rewriterule ^(.*)$http://sub2.new.com$1[last, redirect=permanent]
> ... [ other config requirements - logging, etc. ]
>
>
> ...
>
>
> servername subN.new.com
> serveralias subN.old.com
> rewriteengine on
> rewritecond %{HTTP_HOST} !^$
> rewritecond %{HTTP_HOST} !^subN\.new\.com [nocase]
> rewriterule ^(.*)$http://subN.new.com$1[last, redirect=permanent]
> ... [ other config requirements - logging, etc. ]
>
>
> there is a section in the apache 1.3 url rewriting guide that covers this
> scenario, its called "canonical hostnames".http://httpd.apache.org/docs/1.3/misc/rewriteguid e.html
>
> --sean
>
> --
> sean dreilinger -http://durak.org/sean/
This is exactly what I was looking to do. I was able to use the
server's CNS CNAME address, so the first solution worked.
Thanks!
-- Michael