Web Hosting Talk







View Full Version : Redirect http to https


l0ck_up
11-08-2004, 02:52 AM
I want to redirect http://mydomain.com to https://mydomain.com, so users don't have to type the "s" letter to go to secure connection, how I do this?

FYI, when I go to httpd.conf, there's no <virtualHost> section to make the Rewrite mod, only Alias..bla..bla...

Please give me suggestion, thanks

realvaluehosting
11-08-2004, 03:25 AM
See this thread - http://www.sitepoint.com/forums/showthread.php?t=139605

Flipe.NET
11-08-2004, 08:25 AM
You can do it in .htaccess if you want!
Regards

apollo
11-08-2004, 01:11 PM
you can also do it via modrewrite rules....

l0ck_up
11-08-2004, 11:15 PM
thanks guys, I'll try to work it out ;)

Steven
11-08-2004, 11:23 PM
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [L,R]


Should work in the virtualhost of the http:// version.

l0ck_up
11-08-2004, 11:38 PM
strange!...all of those modrewrite didn't work :(

Steven
11-08-2004, 11:42 PM
Originally posted by l0ck_up
strange!...all of those modrewrite didn't work :(

I have that same setup running here:

http://secure.rack911.com

it redirects to

https://secure.rack911.com

l0ck_up
11-09-2004, 12:41 AM
this is what I have :

NameVirtualHost xxx.xx.xxx.xx:80

<VirtualHost xxx.xx.xxx.xx>
ServerAlias www.mydomain.com mydomain.com
ServerAdmin webmaster@mydomain.com
DocumentRoot /home/mydomain/public_html
BytesLog domlogs/mydomain.com-bytes_log
ServerName www.mydomain.com
<IfModule mod_php4.c>
php_admin_value open_basedir "/home/mydomain:/usr/lib/php:/usr/local/lib/php:/tm$
</IfModule>
User mydomain
Group mydomain
CustomLog domlogs/mydomain.com combined
ScriptAlias /cgi-bin/ /home/mydomain/public_html/cgi-bin/

RewriteLogLevel 1
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [L,R]

</VirtualHost>

after that section is the https part which is :

<VirtualHost xxx.xx.xxx.xx:443>
etc.....

What should I do?