Before launching a new website, one of the decisions you will need to make is to choose between www and no www URLs and redirect www to non-www or vice versa.
For example, the www version of your domain might look something like this:

https://www.mydomain.com

On the other hand, the non-www version usually takes this format:

https://mydomain.com or just mydomain.com

Technically speaking – especially from an SEO standpoint – the two URLs are not the same.

Regardless of the URL format you choose, it’s important to create rewrite rules on your web server that redirect www requests to non-www, or perhaps redirect non-www to www. This is true regardless of whether your site is running on a dedicated server or an apache server.

www or without www: Which to choose?

The truth is that it doesn’t really matter and is not as important as, for example, choosing between http or https. It all comes down to your personal preference.
Non-www URLs are shorter compared to their www counterpart. Other than that, there is no more difference.
Neither option has an SEO advantage over the other, and neither has faster load times than the other.
It’s important to indicate which format you prefer and then redirect visitors to the URL format of your choice.

Redirect to htaccess

To edit the htaccess file, you need the means to access it. The easiest way to access and edit .htaccess is through cPanel. Most server hosting plans come with cPanel.

Using cPanel

First, go to your cPanel Control Panel.

Once logged in, click on File Manager.

Using cPanel

Then scroll down to the public_html section and double click on it.

Using cPanel

After double clicking, you will see .htaccess.

If you cannot find the .htaccess file, it is most likely hidden. To display a hidden file, click the Settings button, check the Show hidden point files box, and click the Save button.

Using cPanel

You should now see the htaccess file.

Right click it and edit. It remains to confirm the changes.

To redirect to www from non-www, copy and paste the following lines of code at the bottom of your .htaccess page:RewriteEngine OnRewriteCond% { HTTP_HOST } ^ yourdomain . com [ NZ ] RewriteRule ^ ( . * ) $ Http : //www.yourdomain.com/$1 [L, R = 301]

Make sure you replace yourdomain.com with your site’s actual domain !!! Once you’re done, click the Save button.

If you want to do the opposite, i.e. force www to redirect to non-www, use the following code instead. This will force a redirect from www to a non-www version of your site.RewriteEngine OnRewriteRule ^ ( . * ) $ Http : //www.yourdomain.com [NZ]RewriteCond% { HTTP_HOST } ^ yourdomain . com / $ 1 [ L, R = 301 ]

Conclusion

To avoid duplicate content issues and therefore poor SEO performance, it is always important to specify whether you want to use the www URL or the non-www version. Once you’ve chosen what works best for your business, the next task is to force a redirect (redirect) to the selected version.

Write A Comment