Support Central » Knowledgebase » Knowledgebase Article Not logged in. Login
 
Announcements

Knowledge Base

Submit a Ticket

Client Login
Article » [How To] Redirect from HTTP to HTTPS using mod_rewrite

Rating:
Was this article helpful? YES NO MODERATELY
Views: 1786
Printable Version


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

(Provided you have an SSL certificate for your domain)

Stick this in your .htaccess file:

CODE:
 
RewriteEngine On 
RewriteCond %{SERVER_PORT} !^443$ 
RewriteRule (.*) [url=https://yourdomain.com/]https://yourdomain.com/[/url] [L]



If you want to simply redirect all requests for a certain directory, for example your shopping cart installation, you can do something like:

CODE:
 
RewriteEngine On 
RewriteCond %{REQUEST_URI} ^/cart/.*
RewriteCond %{SERVER_PORT} !^443$ 
RewriteRule (.*) [url=https://yourdomain.com/]https://yourdomain.com/[/url] [L]



Follow-up and discuss this topic in our forums
Help Desk Powered By ProSupport v0.9.1