Results 1 to 2 of 2

Thread: [How To] Redirect from HTTP to HTTPS using mod_rewrite

  1. #1
    sergey is offline Master Glow Jedi
    Join Date
    Aug 2005

    Default [How To] Redirect from HTTP to HTTPS using mod_rewrite

    We can achieve this using mod_rewrite which is already compiled into your Apache web server here at

    This will redirect any access to the non-secure site to the secure site at

    (Provided you have an SSL certificate for your domain)

    Stick this in your .htaccess file:

    RewriteEngine On 
    RewriteCond %{SERVER_PORT} !^443$ 
    RewriteRule (.*) [L]
    If you want to simply redirect all requests for a certain directory, for example your shopping cart installation, you can do something like:

    RewriteEngine On 
    RewriteCond %{REQUEST_URI} ^/cart/.*
    RewriteCond %{SERVER_PORT} !^443$ 
    RewriteRule (.*) [L]
    Last edited by Matt; 05-13-2008 at 01:26 PM.

  2. #2
    Matt's Avatar
    Matt is offline GlowHost Administrator
    Join Date
    Jan 2005
    Behind your monitor


    Here is a thread that describes how to redirect everything to the "www" version of your website, so that anything like will be converted to

    Redirect to www using mod_rewrite
    Last edited by Matt; 05-13-2008 at 01:25 PM.
    Send your friends and site visitors to GlowHost and get $125 plus bonus!
    GlowHost Affiliate Program | Read our Blog | GlowHost's Facebook | Follow us on Twitter | GlowHost on Google+


Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16