Pages

Friday, 11 July 2014

How to redirect www traffic to non-www url in Joomla when using SSL certificates

If you just want to direct www traffic to you non-www URL then use this guide to edit your .htaccess file.

But if like me you want to add an SSL certificate to your site you will find that the following will happen:

http://mysite.com will got to http://mysite.com
http://www.mysite.com will go to http://mysite.com
https://mysite.com will go to https://mysite.com
https://www.mysite.com will go to http://mysite.com (we want this to go to https, not http)

To do this we use the following instruction:

 RewriteEngine On   
 RewriteCond %{HTTP_HOST} !^mysite\.com   
 RewriteCond %{HTTPS}s on(s)|   
 RewriteRule (.*) http%1://mysite.com/$1 [R=301,L]  

No comments:

Post a Comment