Find the answer to your Linux question:
Results 1 to 4 of 4
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Unhappy 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.

    Last edited by oz; 01-25-2008 at 09:12 PM. Reason: removed corrupted links

  2. #2
    I should add that the above has been corrupted after posting and it should read that if a user types into their address bar what is loaded is

  3. #3
    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.

  4. $spacer_open
  5. #4
    Linux Newbie athlon_crazy's Avatar
    Join Date
    Sep 2007
    For specific vhost:

    <VirtualHost *:80>
    DocumentRoot /mnt/hda5/www
    RewriteEngine On
    RewriteCond &#37;{SERVER_PORT} !^443
    RewriteRule (.*) [R]

    put in your httpd.conf / vhosts.conf. Tested & working on Apache...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts