Why Consolidate www and Apex Domains? (The Importance of 301/308 Redirects)
Have you ever noticed how modern browsers like Chrome, Edge, or Safari behave when you type in a URL? If you enter www.naver.com or www.google.com into the address bar, you'll often see the www disappear, leaving only the Apex Domain. Even mobile-specific m. subdomains are frequently hidden.
This is due to modern browsers adopting a policy of hiding "Trivial Subdomains" to make the address bar appear cleaner. While users might appreciate the shorter, tidier URLs, web developers need to consider a crucial distinction: what browsers hide for display purposes is entirely different from how domains actually function as separate entities.

DNS and Search Bots See 'www' Clearly
In the actual DNS resolution process and for search engine robots (like Googlebot), www.example.com and example.com are distinctly different destinations. If both of these addresses return a 200 OK response and display identical content, it's technically equivalent to operating two separate websites with 'duplicate content'.
Let's examine how global IT companies address this issue using the curl command.
1. Case Study: Yahoo Japan
$ curl -I https://yahoo.co.jp/
HTTP/2 301
location: https://www.yahoo.co.jp:443/
...
When you access Yahoo Japan via its Apex domain, it issues a 301 Moved Permanently redirect to the www address.
2. Case Study: Google
$ curl -I https://google.com/
HTTP/2 301
location: https://www.google.com/
...
$ curl -I https://www.google.com/
HTTP/2 200
...
Google operates similarly. Accessing google.com redirects you to www.google.com, and ultimately, only the www domain returns a 200 response.
Why is Redirection to a Single Domain Essential?
It's not merely about aesthetics. There are clear SEO (Search Engine Optimization) and operational efficiency reasons behind this.
1. Limitations of the Canonical Tag
Many developers assume that setting a <link rel="canonical" href="..."> tag is sufficient. However, a canonical tag is merely a "hint" to search engines. The fact remains that robots still have to crawl both URLs, which wastes Crawl Budget. This means robots might spend time crawling 'copies' of existing content instead of discovering new posts on your site.
2. Dilution of Link Juice
When other websites link to your content, some might include www, while others omit it. Without proper redirection, the authority (Link Juice) that your page should accumulate becomes split between the two domains, putting you at a disadvantage in search ranking competition.
Solution: Enforced Redirection at the Web Server Level
This process is most efficiently handled at the web server (infrastructure) level, such as with Nginx or Apache, rather than at the application code level (e.g., Django, Node.js). Redirecting requests immediately at the server, before they even reach the application, conserves resources and ensures faster response times.
Below is an Nginx configuration example that unifies all requests to the Apex domain (https://example.com) when operating example.com. (If you prefer to unify to www, simply change the target address.)
# 1. www (HTTP) -> Apex (HTTPS)
server {
listen 80;
listen [::]:80;
server_name www.example.com;
return 308 https://example.com$request_uri;
}
# 2. www (HTTPS) -> Apex (HTTPS)
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name www.example.com;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
return 308 https://example.com$request_uri;
}
# 3. Apex (HTTP) -> Apex (HTTPS)
server {
listen 80;
listen [::]:80;
server_name example.com;
return 308 https://example.com$request_uri;
}
# 4. Actual Service Logic (Apex HTTPS 200 OK)
server {
listen 443 ssl http2;
server_name example.com;
# ... service configuration and Proxy Pass etc.
}
Tip: The reason
308status code is used instead of301here is that308 Permanent Redirectmaintains the original HTTP method (e.g., POST, PUT) during redirection, making it a safer choice in modern web environments.
Conclusion
Just because browsers hide addresses doesn't mean servers should ignore the issue. If your www and Apex domains coexist and both return 200 responses, check your web server configuration immediately. Implementing a clear, definitive redirect to one domain is a fundamental and crucial step in clearly communicating your site's identity to search engines.
There are no comments.