Вопрос

I deploy a site and try to login, for instance on www.website.com, but there is no login info when I go to website.com

How to make both domain as same?

Many thanks.

Это было полезно?

Решение

You don't need a domain name server to accomplish this, you can simply use a .htaccess file.

Inside the file, put the lines:

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

What this does is looks at the URL entered by the user, and if it does not start with www. then it prepends it to the URL and redirects. So entering in website.com, will redirect to www.website.com.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top