For SEO reasons, it's best to redirect your non-www site URL to www or vice version.
For example, when trying to access our site via https://joomlashack.com, it redirects to https://www.joomlashack.com. Note the "www" in the second URL.
Technically, the non-www version and the www version are two different domains. So redirecting one to the other improves our SEO. Google and other search engines won't have to worry about two different domains.
This tutorial will show you how to redirect your whole Joomla site to either non-www or www.
- Open your .htaccess file and find the line that reads:
RewriteEngine On
- To redirect non-www to www, add this code below it:
RewriteCond %{HTTP_HOST} ^yourdomain.com [NC] RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [L,R=301]
- To redirect www to non-www, add this code after RewriteEngine On:
RewriteCond %{HTTP_HOST} ^www.yourdomain.com [NC] RewriteRule ^(.*)$ https://yourdomain.com/$1 [L,R=301]
- If the above didn't work for you, check if you're on an IIS server. If so, give this tutorial a try.
What's Next?
Save $1,000's when you sign up to Joomlashack's Everything Club.
You will get access to all our 32 extensions, and legendary support!