1827804 Members
2137 Online
109969 Solutions
New Discussion

Re: http --->https

 
SOLVED
Go to solution

http --->https

I would like to configure apache (1.3.27-3 to let users when they use a browser (ssl enabled) to redirect i.e. http://myserver/homepage automatically to https://myserver/homepage

Thanks in advance
8 REPLIES 8
Dave Falloon
Trusted Contributor

Re: http --->https

This shouldn't be too much of a problem I don't think. Have you setup apache to use ssl yet?

Dave
Clothes make the man, Naked people have little to no effect on society

Re: http --->https

yes, it is already working
Dave Falloon
Trusted Contributor

Re: http --->https

So you want apache to determine the type of browser and then from that decide which version of the page to show, either http or https?

That may be difficult to do within apache. Are you using php or cgi? If so you could do this in your main script.

Here is a link to a tutorial on how one guy used browser detection to change which css he used:

http://www.devarticles.com/art/1/425

If you definately want this in your apache server, you can try something like using the BrowserMatchNoCase directive in the setenvif.c module.

You may be able to use that to set up ssl something like this ( keep in mind I have not tested this I am just giving you an example from the top of my head ):


BrowserMatchNoCase ^Mozilla HTTPS


Or maybe you could replace HTTPS with SERVER_PORT=443

These are just some ideas, and I'm not all that confident that the best way to do this is within apache. I would recommend that all this take place inside a php or cgi script rather than your httpd.conf

I hope that helps,

Dave



Clothes make the man, Naked people have little to no effect on society

Re: http --->https

Ok, it's an idea I didn't thought. however I was thinking about permiting only https web enabled to go to my webpage. I ound a workaround to do that:

A first webpage with this script inside

<script LANGUAGE="JavaScript">

</script>

...I thought it was possible within apache.
Stuart Browne
Honored Contributor
Solution

Re: http --->https

mod_rewrite is your friend I beleive.

RewriteRule ^/(.*) https://new.url.com/$1 [R,NE]

Should do it. See the mod_rewrite documentation for moe details (http://httpd.apache.org/docs-2.0/mod/mod_rewrite.html)
One long-haired git at your service...
Stuart Browne
Honored Contributor

Re: http --->https

(oh, the doc I point to is a Apache2 doc, however the 1.3 is identical (http://httpd.apache.org/docs/mod/mod_rewrite.html)).

(0 pts for this one)
One long-haired git at your service...
Vijaya Kumar_3
Respected Contributor

Re: http --->https

What abt an index.html page with http and do a HTML META REFERESH

-Vijay
Known is a drop, unknown is ocean - visit me at http://vijay.theunixplace.com

Re: http --->https

I did this and works. inside apache In a Virtualhost section


RewriteEngine on
RewriteLog "/var/log/rewrite.log"
RewriteLogLevel 1
Redirect permanent / https://192.168.9.19/


but sure other rules works better ;-)

Thank for klink to the documentation also!!