How to Redirect WWW or Non-WWW through htaccess
Simple Steps to Solve WWW and Non-WWW Redirection through htaccess file
It’s very common questions from all users for all time. But, the concern of this question is very serious like putting all efforts in bucket A and trying to promote a bucket B.
Yes, If you will not solve this problem then it’s going to be the big blow to your business.
It’s better to take a firm decision about your business domain names like if you want to promote your business website with www or non-www.
Taking a decision about www and non-www redirection has multiple benefits like it will be standing as the brand name in the future, it will be a big advantage as search engine marketing, it will be a single uniform format for users and customers, and many more benefits are in a queue.
Let’s take this process in simple steps to solve www and non-www redirection issue through htaccess file in cpanel.
Step 1. Login to your cPanel.
Step 2. Locate the option File Manager to browse a number of files.
Step 3. Click on the Setting option from the top of the right corner.
Step 4. From a pop-up, called “Reference“. Select the radio button “show hidden files” from the root directory of a particular domain name.
Step 5. Discover .htaccess file from the list of files in root directory. Pick the .htaccess file and right click on it. Choose the option “Edit“.
Step 6. Once you choose the option “Edit” option, then you will land on the text editor to edit .htaccess file. In order to solve www and non-www redirection issue, you should paste the below rewrite engine code in .htaccess file.
Note: We mentioned here two types of rewrite engine code, one for www to non-www redirection and another code for non-www to www redirection code. It’s up to you that which type of format you want to choose to promote your business website as the brand and for the search engine.