WordPress self hosted site asking to login again when used www

Each subdomain requires separate authentication. Although you can leave your server set to allow both the “www.example.net” subdomain and the “root” domain “example.net”, you’ll run into issues both with authentication and with SEO, because Google also sees “www.example.net” as a different URL than “example.net”.

It’s best practice to decide which version you prefer, then set up your .htaccess file to redirect all requests of one to the other. That way you only have to log in once, and search engines as well as visitors will all get the same version of your URLs.

If you prefer www:

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

If you prefer no subdomain:

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

Place whichever one you prefer above the default WordPress block in your site root’s .htaccess file.