D
D
david25552019-01-12 18:48:09
htaccess
david2555, 2019-01-12 18:48:09

Redirect from non-www to www in .htaccess?

There is a site that needs to be redirected from domen.com to https://www.domen.com
, that is, no matter what the user writes, redirect it to https from www.
How can I do that?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2019-01-12
@dodo512

RewriteCond %{HTTP_HOST} =domen.com [NC]
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]

Or
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question