Friday 21 October 2016

How To Create Redirects In WORDPRESS?

Sometimes when you open a link, it shows a 404 error. Don’t you get annoyed by it? I bet you do! You probably might be wondering what this error mean? It simply means the particular page of the link you are attempting to access is either temporarily or permanently deleted or moved. Just think if you own a website or blog and delete a page in it, other users when they try to access that particular page may end with receiving a 404 error. They may get annoyed just like you do. So what should be done to avoid this situation?

Don’t you worry at all we have the solution to your problem.
There are three types of redirects you can use to avoid the 404 error:
1) 301 Redirects which implies “Page has been permanently deleted”
2) 302/307 Redirects which implies “Page is temporarily unavailable”
3) Meta Refresh Redirects
If you are using a wordpress platform for your website or blog, then there are some plug-ins available to resolve this error. We will tell you about these plug-ins later in this article.
First, Let’s begin with the 301 error and how to redirect it.
1) 301 Redirect Which Implies “Page Has Been Permanently Deleted”
Suppose you own a website. You have changed its URL structure or you have changed the domain of your website, there is when you need to redirect the users from previous URL to the new one. If you don’t redirect the users to your new URL, they will receive a 404 error in their browsers which will reduce or perhaps nullify the page ranks of your website.
When you redirect your website’s old URL to a new one, the search engines replace the index of your old URL with the new one and pass the page ranks. If you are using an apache server, you can follow the code below for redirection. You just need to mention your old and new location of the page of your website.
  • Redirect 301 / youroldpage.html http://www.yourwebsite.com/yournewpage.html
This way you will be able to redirect an old page link to a new one.
  • Redirect 301 / http://www.yournewwebsite.com
This way you will be able to redirect your whole website to a new one without losing any page ranks.
These codes were to use when you wish the redirection inside your website. But what if you are using a wordpress platform and wish to do the redirection outside the wordpress installation? Here is a simple PHP code you need to add on the header of your page.
  • <?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.yournewwebsite.com");
?>
2) 302/307 Redirect Which Implies “Page Is Currently/Temporarily Unavailable”
When you temporarily delete a page or change its URL, you need to temporarily redirect the old page to a new one otherwise users will be shown “Page not Found” or “Page is currently/temporarily unavailable” error by their browsers. When you use a 307 i.e. temporary redirection, the search engines won’t remove the original URL from their index, owing to the code it knows the redirection is temporary and you will remove it in the future.
A quick way to temporarily redirect is to make use of the $http_response_code parameter in header().
  • <?php
307 Temporary Redirect
header("Location: 
http://www.yournewwebsite.com",TRUE,307);
?>
Both 302 and 307 are used for temporary redirection. If the status code is not specified, header('Location:') it by default takes as 302.
3) Meta Refresh Redirects
Meta refresh is simply refreshing your page. By adding the URL of your new page or website into its syntax you can easily redirect to it. But meta refreshes sometimes may baffle the users as they automatically refresh the pages, user may suspect it as a hacker’s attack. So it’s advisable to not to use much of the meta refresh redirects.
The syntax for Meta refresh is given below:
  • <head>
    <meta http-equiv="refresh" content="30">
    </head>
Here the content=”30” refreshes the page every 30 seconds. The http-equiv gives the value or information of content attribute to the http header. This syntax works on almost every browser.
This was the refresh functionality of Meta mentioned above but, how will you use it to redirect? You can write the following lines of code in your website page to do this job.
<html>
<head>
<meta http-equiv="Refresh" content="10;url=http://www.yournewwebsite.com">
</head>
<body>
<p>Sorry! We have moved our website to a new address!
The new URL is: <a href="http://www.yournewwebsite.com"> http://www.yournewwebsite.com </a></p>
<p>You will be redirected to the new address in ten seconds. </p>
<p>If you see this message for more than 10 seconds, please click on the link above! </p>
</body>
</html>
So, all these codes for redirection are to be writen manually by you.
Did you find these difficult or time consuming? Don’t worry we have another solution your problem. There are various plug-ins available in wordpress for redirection which are too easy and quick to install and execute.
Some of these plug-ins are mentioned below:
  • Redirection
  • Simple 301 Redirects Plug-in
  • Quick Page/Post Redirect Plug-in
  • Safe Redirect Manager Plug-in
  • SEO Redirection
  • Yoast SEO Plug-in
Among these Redirection is the most used plug-in in wordpress for redirecting the website or its pages. In this article we will tell you the essentials about Redirection plug-in and why it is the best plug-in to use for this purpose.
Redirection
Redirection is absolutely free to use. It automatically adds 301 redirections when any URL of the page or website is changed. For 302 and 307 redirections you need to add it manually. There is no need of apache .htaccess. It allows all the three extensions .php, .html, .htm. It provides you with full statistics when the redirection last occurred and how many times it has been done and a lot more stuff. Redirection is available in 25 languages. It keeps all the logs of your redirected URLs. It also keeps the logs for 404 errors so as to easily let you know about the old pages that need to be redirected. Redirection doesn’t slow down your website.
Redirection is simple to install. Follow the steps mentioned under for installation:
Step 1: Download redirection.zip
Step 2: Unzip
Step 3: Upload redirection directory to your /wp-content/plugins directory
Step 4: Go to the plugin management page and enable the plugin
Step 5: Configure the options from the Manage/Redirection page

 To know how to install redirection in detail, refer this site http://urbangiraffe.com/articles/how-to-install-a-wordpress-plugin/
Ncode, Technologies, Inc. has its highly qualified wordpress plug-in developers who make the success of websites and blogs made by NCode Technologies, Inc. possible.