Robert
Robert

Reputation: 778

redirecting everything to https://www.domain.com

How would I write the.htaccess file to https://www.domain.com

example

domain.com => https://www.domain.com
www.domain.com => https://www.domain.com
https://domain.com => https://www.domain.com
http://www.domain.com => https://www.domain.com

Upvotes: 0

Views: 84

Answers (2)

alincc
alincc

Reputation: 36

Try the following rule:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

Upvotes: 2

Drazisil
Drazisil

Reputation: 3343

Options +FollowSymlinks
RewriteEngine on

RewriteRule ^(.*)$ https://www.domain.com/$1 [R=301,L]

This is the code i use. I checked it at http://htaccess.madewithlove.be/ as well :)

Upvotes: 0

Related Questions