Redirect http to https and www

To forward a website to use both www. and https:// use the following in an .htaccess file:

RewriteCond %{HTTPS} off
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]


If that code doesn't work please try the following...


RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*) https://www.%{SERVER_NAME}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTPS} off
RewriteRule ^(.*) https://%{SERVER_NAME}%{REQUEST_URI} [L,R=301]

  • 4 Users Found This Useful

Was this answer helpful?

Related Articles

Creating a Form Button

Sometimes all you need is a simple button. The following pages are pretty useful tools for...

I need a module installed but I do not have rights

No problem. Send us a trouble ticket and we will install the module as long as there are no...

Do you have a firewall?

Yes, our servers have firewalls. For security we close off unused ports and update the server...

Common Search Engine Optimization Tips

Get other websites to link to you. Have your website linked and posted in socal media...

Why do I get emails for cron jobs?

This is the default. If you would like to disable receiving emails when a cron job runs append...