How to Redirect Your Preferred Domain with WP 301 Redirect?
WordPress 301 Redirect is a server side redirect that is used to set up permanent redirection. Its 301 code shows that a page or domain(s) has moved to a new space completely.
This efficient and permanent redirection immediately informs all browsers of your visitors to edit or modify their impacted bookmarks. The utility also helps to redirect search engines such as Google from a certain URL or domain to another. There are different situations where you would want to do 301. In this article, I am going to talk about the 301 redirection particularly in WordPress.
It is advisable (however not necessary) that you decide a domain to work on and then start to perform WordPress 301 redirection.
How can you choose the preferred domain with the help of Google Webmaster Tools?
- Utilize free services of Google Webmaster Tools.
- Log in to the Google Webmaster Tools.
- Include two sites in your Google Webmaster Tools like www.yourdomain.com and yourdomain.com.
Keep in mind that at this stage, you are only including the two sites. Simply consider them as 2 sites with slight difference in labels. After you have added the two sites, it will get easier for you to set the preferred domain.
After this step, set your required domain for the two sites. (You can either select the non-www version or www-version as the required domain). If you want to get my opinion, then I would choose www-version as the required domain.
Once you are done with Google Webmaster Tools, get back to your WordPress admin window.
Setting the WP 301 redirect
There are a number of ways to achieve a WP 301 redirect, including:
- WP- which is suitable for users who have WO self hosted installation
How you can conveniently develop a 301 server redirect in WP
For instance you are installing WordPress in your root directory, it is obvious that you are using the same domain like before i.e. yourdomain.com.
Then you can set the required domain to www.version. After that, you will have to enforce the server side of 301 redirect so that every aspect gets added to your preferred domain. You can easily do that in WordPress by yourself.
Your WordPress Admin dashboard>>Settings>>Then click General
Change the WO URL (address) and the site URL (address) from yourdomain.com to the www.yourdomain.com- which is your preferred domain.
Click SAVE button and it’s done! Wasn’t that easy and fun?