How do I add the "www." to a website i've set up to have no www. (example: mydomain.com --> www.mydomain.com)
Any answers would be greatly appreciated!
How do I add the "www." to a website i've set up to have no www. (example: mydomain.com --> www.mydomain.com)
Any answers would be greatly appreciated!
Short answer: add a permanent (301) redirect for the naked domain to the www host, or use your registrar/CDN to forward the apex. Verifying both forms in Search Console (as mentioned) helps reporting, but it does not redirect visitors — Google removed the old “preferred domain” control and prefers redirects / canonical signals instead. (See Google’s note.) Bye Bye Preferred Domain setting
Options (pick one that fits your host):
# Apache (in your virtual host for example.com)
<VirtualHost *:80>
ServerName example.com
Redirect 301 / http://www.example.com/
</VirtualHost> # NGINX (server block to preserve scheme and path)
server {
listen 80;
server_name example.com;
return 301 $scheme://www.example.com$request_uri;
} DNS notes and pitfalls:
Practical cautions:
*.example.com does not, by itself, cover the apex unless the apex is explicitly included). Wildcard / SAN notes (DigiCert)Quick test (after change):
curl -I http://example.com
# expect "HTTP/1.1 301" and a Location: header pointing to the www URL If redirects loop, check for double redirects (HTTP -> HTTPS and then non-www -> www); fix by consolidating rules and ensuring certs and DNS are set for both names.
in google webmaster tools you just verify both the www.yourdomain.com and yourdomain.com you then go to setting and choose which one you want to appear in webmaster tools settings
okay, yes. but change it on my domain. so instead of it being domain.com it literally appears as www.domain.com
you can do that from htaccess, add the following code :
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ [R=301,L]
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.