You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Joe Hansen <jo...@gmail.com> on 2012/03/19 21:53:12 UTC

[users@httpd] How to redirect all requests for domain A to domain B

Hi All,

I'd like to redirect all (http and https) requests for domain a.com to
domain b.com.

I have the following in the apache config files:
 Redirect https:/a.com https://www.b.com
Redirect http://a.com http://www.b.com

Though all the http requests are correctly getting redirected, https
requests aren't. What do I need to do to get this working?

Thanks,
Joe

Re: [users@httpd] How to redirect all requests for domain A to domain B

Posted by Joe Hansen <jo...@gmail.com>.
Julien, I appreciate the reply, but I need a redirect. I do not want the
content on b.com to appear on a.com. So ServerAlias will not work for me.

Thanks,
Joe.

On Mon, Mar 19, 2012 at 3:14 PM, Julien Cigar <jc...@ulb.ac.be> wrote:

>  On 03/19/2012 21:53, Joe Hansen wrote:
>
> Hi All,
>
>  I'd like to redirect all (http and https) requests for domain a.com to
> domain b.com.
>
>  I have the following in the apache config files:
>  Redirect https:/a.com https://www.b.com
>  Redirect http://a.com http://www.b.com
>
>
>
> You can also use the ServerAlias directive
>
>
>
>  Though all the http requests are correctly getting redirected, https
> requests aren't. What do I need to do to get this working?
>
>  Thanks,
> Joe
>
>
>
>

Re: [users@httpd] How to redirect all requests for domain A to domain B

Posted by Julien Cigar <jc...@ulb.ac.be>.
On 03/19/2012 21:53, Joe Hansen wrote:
> Hi All,
>
> I'd like to redirect all (http and https) requests for domain a.com 
> <http://a.com> to domain b.com <http://b.com>.
>
> I have the following in the apache config files:
> Redirect https:/a.com <http://a.com> https://www.b.com
> Redirect http://a.com http://www.b.com
>


You can also use the ServerAlias directive


> Though all the http requests are correctly getting redirected, https 
> requests aren't. What do I need to do to get this working?
>
> Thanks,
> Joe
>
>


Re: [users@httpd] How to redirect all requests for domain A to domain B

Posted by Rich Bowen <rb...@rcbowen.com>.
On Mar 19, 2012, at 4:53 PM, Joe Hansen wrote:

> Hi All,
> 
> I'd like to redirect all (http and https) requests for domain a.com to domain b.com. 
> 
> I have the following in the apache config files:
> 	Redirect https:/a.com https://www.b.com
> 	Redirect http://a.com http://www.b.com
> 
> Though all the http requests are correctly getting redirected, https requests aren't. What do I need to do to get this working?

This isn't valid at all. The first argument of a Redirect directive is a URL path, not a fully-qualified URL.

Your question is answered here: http://httpd.apache.org/docs/trunk/rewrite/remapping.html#canonicalhost  The solutions offered are in decreasing order of best practice, but note that the <If> syntax is only available in 2.4.

You should, of course, consider upgrading to 2.4 if possible.


--
Rich Bowen
rbowen@rcbowen.com :: @rbowen
rbowen@apache.org







Re: [users@httpd] How to redirect all requests for domain A to domain B

Posted by Joe Hansen <jo...@gmail.com>.
Hey Mario,

Thanks so much for replying.

I found <VirtualHost *:443> line in the httpd-ssl.conf file. I added
Redirect / https://www.b.com

I restarted Apache but when I visit https://a.com, the browser doesn't
redirect me to b.com. I am lost! :(

Thanks,
Shashi


On Mon, Mar 19, 2012 at 5:21 PM, Mario A. del Riego <de...@fing.edu.uy>wrote:

> I must add this redirect to the VirtualHost's SSL.
>
> You need to know where its added, if you type:
>
> apachectl -S
>
> will see something like:
>
> [...]
> *:443    is a NameVirtualHost
> default server localhost (/etc/httpd/conf.d/ssl.conf:12)
> [...]
>
> In this file you have to do it.
>
> Search for something "<VirtualHost *:443>" and add the redirect directive.
>
> Redirect / https://www.b.com
>
>
>
> El 19/03/12 17:53, Joe Hansen escribió:
> > Hi All,
> >
> > I'd like to redirect all (http and https) requests for domain a.com
> > <http://a.com> to domain b.com <http://b.com>.
> >
> > I have the following in the apache config files:
> > Redirect https:/a.com <http://a.com> https://www.b.com
> > Redirect http://a.com http://www.b.com
> >
> > Though all the http requests are correctly getting redirected, https
> > requests aren't. What do I need to do to get this working?
> >
> > Thanks,
> > Joe
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

Re: [users@httpd] How to redirect all requests for domain A to domain B

Posted by "Mario A. del Riego" <de...@fing.edu.uy>.
I must add this redirect to the VirtualHost's SSL.

You need to know where its added, if you type:

apachectl -S

will see something like:

[...]
*:443    is a NameVirtualHost
default server localhost (/etc/httpd/conf.d/ssl.conf:12)
[...]

In this file you have to do it.

Search for something "<VirtualHost *:443>" and add the redirect directive.

Redirect / https://www.b.com



El 19/03/12 17:53, Joe Hansen escribió:
> Hi All,
> 
> I'd like to redirect all (http and https) requests for domain a.com
> <http://a.com> to domain b.com <http://b.com>. 
> 
> I have the following in the apache config files:
> Redirect https:/a.com <http://a.com> https://www.b.com
> Redirect http://a.com http://www.b.com
> 
> Though all the http requests are correctly getting redirected, https
> requests aren't. What do I need to do to get this working?
> 
> Thanks,
> Joe
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org