Results 1 to 4 of 4
First off, I know absolutely nothing about coding so please be gentle and reply as if I'm an idiot!
I have a website on a Linux based virtual server so ...
- 01-25-2008 #1Just Joined!
- Join Date
- Jan 2008
- Posts
- 2
Redirecting http to https on virtual server
First off, I know absolutely nothing about coding so please be gentle and reply as if I'm an idiot!
I have a website on a Linux based virtual server so it uses both ports 80 and 443. I need visitors to go to the https version of the site for payment collection but as most users will not type in https or http they are immediately directed to http.
* [moderator edit: removed corrupted links]
various forums have advised that the .htaccess file should read:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
and this should work. My htaccess files does read this, but it doesn't work.
Can anyone help!! Please speak very s-l-o-w-l-y if you are kind enough to do so.
ThanksLast edited by oz; 01-25-2008 at 09:12 PM. Reason: removed corrupted links
- 01-25-2008 #2Just Joined!
- Join Date
- Jan 2008
- Posts
- 2
I should add that the above has been corrupted after posting and it should read that if a user types www.myoldwebaddress.com into their address bar what is loaded is https://www.myoldwebaddress.com
- 01-25-2008 #3Linux Guru
- Join Date
- Nov 2007
- Posts
- 1,695
The .htaccess code you have assumes that Apache is running with mod_rewrite support compiled and enabled. If it's your Apache, you can correct this. If it's a hosting company, they may/may not change it for you. You'll have to contact them.
There are several other ways to redirect requests. You may want to look at the Javascript or PHP methods.
- 01-26-2008 #4
For specific vhost:
</VirtualHost>
<VirtualHost *:80>
ServerAdmin admin@domain.com
DocumentRoot /mnt/hda5/www
ServerName domain.com
ServerAlias www.domain.com
RewriteEngine On
RewriteCond %{SERVER_PORT} !^443
RewriteRule (.*) https://www.domain.com/ [R]
</VirtualHost>
put in your httpd.conf / vhosts.conf. Tested & working on Apache...


Reply With Quote