Are you looking to keep your website clean, professional, and SEO-friendly? Then you absolutely must know how to redirect www to non-www properly. It’s one of the most overlooked yet impactful optimizations you can make. But if you’ve ever felt confused about terms like redirect, www, non-www, or tangled up in that snippet of code called .htaccess, you’re not alone.
In this comprehensive, step-by-step guide, you’ll learn how to redirect www to non-www properly—whether you’re using Apache, Nginx, Cloudflare, cPanel, or another system. We’ll answer your top questions, debunk myths, and walk through real-life examples. By the end, you’ll know exactly how and why to set up redirects, and avoid mistakes that could hurt your website’s performance, security, and SEO. Let’s get started on unifying your brand and taking control of your domain!
What is Redirecting www to non-www?
When someone visits your website, they might type www.yourdomain.com or simply yourdomain.com into their browser. To computers and search engines, these can be seen as two totally separate addresses, unless you explicitly tell them otherwise.
Redirecting www to non-www means that anyone who enters “www” before your domain is automatically and instantly brought to your main (canonical) version—without the “www” prefix.
For example, if you own digitalwithsandip.com and a visitor types www.digitalwithsandip.com, they’ll be seamlessly redirected to digitalwithsandip.com.
This is usually done using “301 redirects,” which are web instructions that tell browsers (and search engines) that the page has “moved permanently” to the new address. Without this redirect, your site could appear with and without “www”—leading to confusion and SEO issues.
Why It Matters: Benefits of Proper Redirection
Why bother learning how to redirect www to non-www properly? Here are the most important benefits this simple fix provides:
- Improved SEO: Eliminates issues with duplicate content and helps consolidate link authority for better rankings.
- Consistent Branding: Keeps your URL structure uniform across all platforms and links.
- Better Analytics: Ensures visitor statistics are all tracked under one main domain, giving you clear insights.
- Enhanced User Experience: Visitors always land on the correct page, avoiding confusion or mismatch.
- Prevents Split Indexing: Search engines only index one version of your site.
- Boosted Site Trust: Uniform links signal professionalism and help establish your brand’s reputation.
- SSL/TLS Security: Reduces risk of SSL errors by forcing traffic to your canonical SSL-protected URL.
Use Cases & Real-World Examples
Still wondering who needs to redirect www to non-www? Here are some practical cases:
- SEO Agencies: Ensuring all client sites use a single canonical domain to boost Google rankings.
- Ecommerce Stores: Directing both www and non-www traffic to a unified shop URL for better trust and conversions.
- Bloggers and Influencers: Making sure all content shares, backlinks, and mentions point to the right domain.
- Startups: Launching a new site and wanting a simple, modern non-www brand identity.
- Tech Companies: Preventing technical SEO misconfigurations for SaaS platforms or cloud tools.
For example, let’s say “www.example.com” and “example.com” both work for your blog. Google may treat them as different sites—splitting your SEO power. By setting a proper 301 redirect from “www” to non-www, all traffic, backlinks, and search equity flow to your chosen domain.
How to Redirect www to non-www Properly: Step-by-Step Guide
It’s crucial to do this properly, using the correct redirects and only in the right files or dashboards. Here’s how, using different platforms and technologies:
Warning: Always back up your site and .htaccess or server config files before making changes!
1. Apache/.htaccess (Most Common)
If your website uses Apache hosting (most cPanel or shared hosts), follow these steps:
1. Connect to your website via FTP or File Manager.
2. Open the .htaccess file in your website’s root directory.
3. Add the following code at the top, replacing yourdomain.com with your real domain:
RewriteEngine On RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] RewriteRule ^ https://%1%{REQUEST_URI} [L,R=301]
Save and upload the file. That’s it! Now, typing “www.yourdomain.com” will always redirect to “yourdomain.com”.
StackOverflow Guide on .htaccess Redirection
2. Nginx
Nginx doesn’t use .htaccess, so configuration is a bit different. Edit the server block in your “nginx.conf” or virtual host file:
server { listen 80; server_name www.yourdomain.com; return 301 $scheme://yourdomain.com$request_uri; }
Reload Nginx after saving changes:
sudo systemctl reload nginx
Tribulant Nginx/Apache Redirection Docs
3. Cloudflare Page Rules
If you use Cloudflare as your DNS/CDN, create a Page Rule:
1. Login to your Cloudflare Dashboard.
2. Go to Rules > Page Rules.
3. Add a rule:
URL pattern: www.yourdomain.com/*
Setting: Forwarding URL (301 – Permanent Redirect)
Destination: https://yourdomain.com/$1
Save and deploy.
Cloudflare Redirection Guide
4. cPanel Redirects
For many shared web hosts, use the built-in Redirection tool:
1. Log in to cPanel.
2. Go to Domains > Redirects.
3. Set www.yourdomain.com to redirect permanently (301) to yourdomain.com.
4. Save.
SiteGround Non-www Redirection Tutorial
5. WordPress Plugins
Not comfortable editing code? There are trusted SEO plugins like Rank Math and Redirection that offer non-www redirects directly in the dashboard.
Setup usually involves:
– Installing and activating your chosen plugin
– Setting your preferred domain (“non-www”) as canonical
– Enabling Force Redirect options
Rank Math Non-www Redirect Documentation
Challenges, Myths, and Common Objections
Redirecting www to non-www properly is generally safe and recommended, but here are common concerns:
- “Will it hurt my SEO?” No—if done with a 301 redirect, SEO value is passed. In fact, it prevents duplicate content issues.
- “Should I use www or non-www?” Both are equally valid. What matters most is consistency.
- “Can I lose traffic?” Not if you test your redirects and there are no typos in the configuration.
- “Is non-www less professional?” No—brands like Google, Facebook, and Twitter use non-www addresses. Choose what suits your brand best.
- “Do I need SSL on both versions?” Ideally, yes. But if you only serve content via non-www, that’s the domain you must secure.
- “Will this break my email or DNS?” Properly configured redirects won’t affect email or other subdomains.
FAQs: How to Redirect www to non-www Properly
1. What is a 301 redirect and why is it important for www to non-www?
A 301 redirect is a permanent redirection instruction for browsers and search engines. It transfers SEO authority and ensures users land on the correct address, preventing duplicate content and maximizing ranking power.
2. Does redirecting www to non-www affect my search engine ranking?
No, a proper 301 redirect consolidates your domain authority and usually improves your ranking by eliminating split SEO signals.
3. Can I use .htaccess for subdomains other than www?
Yes, with advanced rules. But typical www to non-www redirects shouldn’t impact other subdomains like blog.yourdomain.com or shop.yourdomain.com.
4. Do I need to edit DNS records to redirect www to non-www?
No, DNS determines where your domain points. Redirections should be handled at the web server, CDN, or app level.
5. Why not keep both www and non-www live?
Having both live causes duplicate content, splits backlinks, and confuses search engines. Always pick one and redirect the other.
6. Should I use plugins or do manual redirects?
Plugins are faster and safer for beginners. Manual code offers more control for advanced users or complex sites.
7. Will browsers cache my redirect?
Yes, most browsers cache 301 redirects. Test in incognito mode or different browsers after setting up.
8. Do I need an SSL certificate on both versions?
Yes, if both versions are accessible. If only non-www is live, it’s needed there. Always renew certificates to avoid browser warnings.
9. Can a redirect slow down my site?
A single redirect is almost instant. Problems only occur if you chain redirects (redirect A → B → C), so keep the process simple.
10. What if I want to redirect to www instead of non-www?
Reverse the code logic and use www as your main domain. Just ensure all links and Google Search Console are updated to match!
Conclusion: Take Charge of Your Domain with Proper Redirection
Mastering how to redirect www to non-www properly is a simple, powerful way to improve SEO, analytics, user experience, and branding. Whether you use Apache, Nginx, Cloudflare, cPanel, or a WordPress plugin, following the correct steps will unify your traffic and protect your site.
Remember: Consistency is key. Set up your preferred domain version, use proper 301 redirects, and double-check your configuration. By taking this action today, you’ll eliminate duplicate content, make Google love your site, and present your brand with clarity and authority.
If this guide helped you, bookmark it, share it, or check out our other SEO and technical optimization resources at Digital With Sandip — your go-to for hands-on web mastery!