Home » .htaccess » How to redirect www URLs to non-www

How to redirect www URLs to non-www

In this post, We going to see how to redirect www URLs to non-www. They are two URLs for the domain one is www and another one non-www but these two URLs are different, In case you have both of them in the .htaccess file the server confuse to redirect to the page and it also affects your (SEO)Search Engine Optimization and ranking. So before doing this chose the correct method you need to redirect.

You can redirect all the www request to non-www by modifying your website’s using .htaccess. Add the following code at the beginning of the file so that the redirection is properly works and the main thing you need to replace yourdomain.com with your exact domain name. Right click and edit the .htaccess file using Editor view.

Here below the code:

From now on, when visitors access http://www.yourdomain.com that will be redirected to http://yourdomain.com.

Was this article helpful?

Yes No

How can we improve it?


We appreciate your helpul feedback!

Your answer will be used to improve our content. The more feedback you give us, the better our pages can be.

Follow us on social media:

Facebook Pinterest


Creative Designer & Developer specialist by the spirit and a loving blogger by thoughts.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top