How to Redirect non-WWW Version to WWW Version of Your Website


If you’re trying to deal with URLs on your website redirecting to the incorrect variations, you may have to redirect the non-WWW version of your website to the WWW version of your site (if that’s the primary URL of your site) or vice versa. Luckily, besides all the cool behind-the-scenes improvements in Rank Math, it also makes it extremely easy to fix the dreaded “redirection of non-www to www version” in no more than a few minutes…

In this knowledgebase article, we’re going to walk you through how to redirect the non-www version to the www version of your website.

How to Redirect Non-WWW Version to WWW Version

To redirect non-www to www version, you’ll need to enter a piece of code in the .htaccess file.

1 Edit .htaccess File

Rank Math lets you edit your website’s .htaccess file right inside the WordPress dashboard. To edit the file, navigate to the WordPress Dashboard > Rank Math > General Settings > Edit .htacess as shown below:

Edit .htaccess file in Rank Math

2 Add the Redirection Rule

To add a redirection rule to your .htaccess file, click the check box below the warning and add the code snippet after #END WordPress.

Add code to .htaccess file

Add the following code snippet and click on Save Changes.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^ [NC]
RewriteRule ^(.*)$$1 [L,R=301]

And that’s it! You have successfully enabled a .htaccess rule that will redirect all visitors from a non-www version to the www version of your website! If you still have any questions about how to redirect the non-www version to the www version of your website – you’re always more than welcome to contact our dedicated support team. They are available 24/7, 365 days a year…

This post was originally posted here

Check out our Starter Sites built with #ToolWeLove including Toolset, Elementor Pro, and Astra Pro.


Share this page
Share on facebook
Share on google
Share on twitter
Share on linkedin
Share on email
How to Choose WordPress Hosting

Pixallus WordPress Hosting. Simplified. Enjoy blazing fast WordPress website loading speeds and 99.9% uptime. Whether you’re a freelancer, small business, or a large organization, we

Read More »