Today I will show you how to set up in the best way possible, the redirects in WordPress
There are 101 reasons why you might need to redirect one URL to another, but it is not a feature that comes as standard in WordPress. Fortunately, there are quite a few plugins out there that can handle URL redirects for you. I know, because I have used a lot of them. Some very simple, some rather complicated. But in my opinion, by far the best redirection plugin available is the aptly named Redirection.
There is just one problem – compared to other less complicated redirection plugins, Redirection can seem rather overwhelming. Whilst you can use something like the simple Quick Page/Post Redirect Plugin, you would be far better off installing its bigger brother and taking a few minutes to better understand how it can better serve you.
Setting Up Redirects
Once you have installed and activated Redirection, you can access the plugin’s screens by hovering over the Tools option in your sidebar and selecting the appropriate option.
You will then be presented with the Add New Redirection screen:
There are a few potentially confusing options here, but don’t worry – if you just want to set up a simple redirect, you don’t need to do anything out of the ordinary. Just enter the URL for which you want to set up the redirect in the “Source URL” box, and the destination URL in the “Target URL” box. Hit “Add Redirection”, and you’re all set! That’s all there is to it.
Here’s a little tip to save you time – you do not need to enter your site’s domain in the “Source URL” box – just the extension. Let’s say your site was “http://www.mysite.com/” and you wanted to redirect the URL: “http://www.mysite.com/myurl/”. In order to set up the redirect, you only need to type in “/myurl/” in the “Source URL” box – the plugin will do the rest for you.
If you are going to be doing lots of redirects, it would be advisable to group them by type.
For instance, let’s say I wanted to create some URLs to mask affiliate links on my site (so that when my visitors hovered over a link, they saw “http://www.mysite.com/recommends/product/” rather than “http://www.affiliatesite.com/youraffiliateid”). It would make little sense to have these redirects bunched in with other unrelated ones. So I should set up a group for my affiliate links.
First, click on “Groups” from any of the plugin’s screens:
On the resultant screen, you can add and manage your groups. Using the example above, let’s type in “Affiliate Links” in the add groups box, and hit “Add”. The group is then listed on the page:
To add redirects to a specific group, just click on it and then enter redirections as normal in the subsequent screen.
Fix 404s With Ease
Setting up a redirect from one of these 404 errors to the intended page is just as simple as clicking the green plus icon to the right of the link, and then entering the target URL.
If you want to set a particular 404 error so that it is ignored in the future, just add the URL as a redirect and select “Do nothing” from the “Action” drop down box. It would be a good idea to keep all such redirects in an appropriately named group.
There are many reasons why you might like to keep track of clicks on a particular link, and Redirection has a built-in ability to do so – even for URLs that you do not wish to redirect.
Say you wanted to track how many times your visitors visited a specific external website linked to from your blog. All you would need to do is add the website in question as a Source URL as you would do for any redirect, but then select “Do nothing” from the “Action” drop down box (as you did above for ignoring 404 errors). The URL will show up as a redirect, and you will be able to see the number of times it has been clicked to the right of your screen. You can even click on the URL to give it a name:
Making sure that your site doesn’t get bogged down by plugins should always be a key priority. With that in mind, there are three things you should pay attention to regarding Redirection, which are found in the Options screen:
If you do not need to log redirect or 404 requests, uncheck these boxes. In all honesty, I don’t believe that keeping these boxes checked will have a major impact on most blogs. What you should however make a change to is the log expiry option found just below. If you leave the option set to zero, data will be collected indefinitely. Far better to keep things a bit more manageable – I would suggest you set items in the log to expire after 30 days.