Redirect http to https and www to https with htaccess

Here is how to simply redirect your domain to always use https:// with no www.

This htaccess file will redirect:

And here it is:

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^www.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

Simply create this as your .htaccess file and upload.

Or just download this htaccess file in zip format (also in this zip is file.htaccess incase the .htaccess is invisible, just upload file.htaccess and rename to .htaccess).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s