Mailing List Archive

redirecting from http -> https
I want to redirect anyone using an http:// url to the equivalent https://
url on my site.

Eg http://www.acme.com/somedir/foo.htm ->
https://www.acme.com/somedir/foo.htm

I've tried the Redirect declaration

Redirect http://www.acme.com/ https://www.acme.com

but that seems to do nothing.

Any ideas?

I guess this is a common thing to want to do.




---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: redirecting from http -> https [ In reply to ]
Tim Fox wrote:
>
> I want to redirect anyone using an http:// url to the equivalent https://
> url on my site.
>
> Eg http://www.acme.com/somedir/foo.htm ->
> https://www.acme.com/somedir/foo.htm
>
> I've tried the Redirect declaration
>
> Redirect http://www.acme.com/ https://www.acme.com
>

Read more carefully the note on "Redirect" - it takes a local path
relative to the docroot as its first argument, not a full URL. Also,
didn't you see the question and answer on the list about two hours ago
on this very point?

Rgds,

Owen Boyle.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
RE: redirecting from http -> https [ In reply to ]
> -----Original Message-----
> From: obo@bourse.ch [mailto:obo@bourse.ch]
> Sent: 14 February 2002 13:32
> To: users@httpd.apache.org
> Subject: Re: redirecting from http -> https
>
>
> Tim Fox wrote:
> >
> > I want to redirect anyone using an http:// url to the
> equivalent https://
> > url on my site.
> >
> > Eg http://www.acme.com/somedir/foo.htm ->
> > https://www.acme.com/somedir/foo.htm
> >
> > I've tried the Redirect declaration
> >
> > Redirect http://www.acme.com/ https://www.acme.com
> >
>
> Read more carefully the note on "Redirect" - it takes a local path
> relative to the docroot as its first argument, not a full URL.

I tried that - it ended up in a recursive loop.
Specifically I tried:

Redirect /somedir https://www.acme.com/somedir/

This seems to end up in a recursive loop -which makes sense since
https://www.acme.com/somedir matches /somedir.

I have also tried:

Redirect / https://www.acme.com/

which also seems to end up in a loop

> Also,
> didn't you see the question and answer on the list about two hours ago
> on this very point?
>

No, because I only joined the list about 15 minutes ago, in order to ask the
question.

> Rgds,
>
> Owen Boyle.
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: redirecting from http -> https [ In reply to ]
Tim Fox wrote:
>
>
> Redirect /somedir https://www.acme.com/somedir/
>
> This seems to end up in a recursive loop -which makes sense since
> https://www.acme.com/somedir matches /somedir.

Where did you put the Redirect? It goes in the HTTP-VH, not in the
SSL_VH... Something like (cribbed from NickM's earlier answer):

<VirtualHost 12.34.56.78:443>
ServerName myvirtual.domain
SSLEngine on
</VirtualHost>

<VirtualHost _default_:80>
Redirect / https://myvirtual.domain
</VirtualHost>

This redirect will never be seen by a request on port 443 so should
never cause a loop.

Rgds,

Owen Boyle.

> > didn't you see the question and answer on the list about two hours ago
> > on this very point?
>
> No, because I only joined the list about 15 minutes ago, in order to ask the
> question.

Remarkable! It is actually quite amazing how often questions tend to be
clustered like this... Oh, and the other Q&A was on the mod_ssl list...

http://marc.theaimsgroup.com/?l=apache-modssl&m=101367928502889&w=2

Sorry!

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
RE: redirecting from http -> https [ In reply to ]
On Thu, 14 Feb 2002, Tim Fox wrote:
>
> Redirect /somedir https://www.acme.com/somedir/

> which also seems to end up in a loop


are your DocumentRoot's the same place for the https
and the http virutal host?

That would most likely loop it.
Your syntax is correct.

-k


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
RE: redirecting from http -> https [ In reply to ]
I don't have any virtual hosts, I only have one DocumentRoot, and I want to
force SSL across the site.
I have no need of 2 docroots since I only have one set of documents that I
want to be served over HTTPS everytime.
I do not want these documents to be ever served over HTTP.
The idea is that if the user attempts to access any of the resources on HTTP
they will be redirected to the same resource but over the HTTPS protocol.
Are you suggesting I need to make 2 copies of my web site and put it in
virtual servers for this to work?

> -----Original Message-----
> From: Kevin M. Shortt [mailto:shortt@cgicafe.com]
> Sent: 14 February 2002 14:30
> To: users@httpd.apache.org
> Subject: RE: redirecting from http -> https
>
>
>
> On Thu, 14 Feb 2002, Tim Fox wrote:
> >
> > Redirect /somedir https://www.acme.com/somedir/
>
> > which also seems to end up in a loop
>
>
> are your DocumentRoot's the same place for the https
> and the http virutal host?
>
> That would most likely loop it.
> Your syntax is correct.
>
> -k
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
RE: redirecting from http -> https [ In reply to ]
> I don't have any virtual hosts, I only have one DocumentRoot, and I want to
> force SSL across the site.


errrt...no virutal hosts. That's the prob.
You need them.


http://httpd.apache.org/docs-2.0/ssl/ssl_faq.html#ToC17
or
http://www.modssl.org/docs/2.3/ssl_faq.html#ToC13



Good Luck..

-k



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
RE: redirecting from http -> https [ In reply to ]
It seems that is my solution.
Thanks for your help.


> -----Original Message-----
> From: Kevin M. Shortt [mailto:shortt@cgicafe.com]
> Sent: 14 February 2002 18:01
> To: users@httpd.apache.org
> Subject: RE: redirecting from http -> https
>
>
>
> > I don't have any virtual hosts, I only have one DocumentRoot,
> and I want to
> > force SSL across the site.
>
>
> errrt...no virutal hosts. That's the prob.
> You need them.
>
>
> http://httpd.apache.org/docs-2.0/ssl/ssl_faq.html#ToC17
> or
> http://www.modssl.org/docs/2.3/ssl_faq.html#ToC13
>
>
>
> Good Luck..
>
> -k
>
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org