history73
history73

Reputation: 39

Redirect all url to the http//www with .htaccess

Using .htaccess, I need to redirect all requests from

http://domain,

https://domain

https://www.domain

to

http://www.domain

Thanks,

Upvotes: 0

Views: 49

Answers (2)

Amit Verma
Amit Verma

Reputation: 41219

To redirect to https://www you can use :

RewriteEngine on

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

Upvotes: 0

Emmanuel agahiu
Emmanuel agahiu

Reputation: 120

copy this to your .htaccess file.

RewriteEngine On
    RewriteCond %{SERVER_PORT} !=443
    RewriteCond %{HTTP_HOST} ^(www.example)?.com$ [NC]
    RewriteRule ^$ http://www.example.com%{REQUEST_URI} [R,L]

Upvotes: 1

Related Questions