문제

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