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

This will redirect any access to the non-secure site to the secure site at https://yourdomain.com

Make sure you have an SSL certificate for your domain!

 

Stick this in your .htaccess file:

 

RewriteEngine On 
RewriteCond %{SERVER_PORT} !^443$ 
RewriteRule (.*) https://yourdomain.com/ [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 (.*) https://yourdomain.com/ [L]

 

 

 

Related articles

Related articles appear here based on the labels you select. Click to edit the macro and add or change labels.

Related issues