How to make redirects on your WordPress site?

0
268

Make redirects on WordPress with the Redirection plugin

 

WordPress Redirection Plugin

 

With 900,000 active installations, Redirection is the most popular extension of the official directory to handle redirections. Easy to use, intuitive, and quick to set up, it allows to create redirects without touching any line of code. Our seo expert in lahore wants to show the right way to beginners.

If you are new to WordPress and want to redirect one page to another, do not hesitate to use it. Thanks to her, you will be able to.

 

  • Create different types of redirects
  • Handle the 404 errors present on your site;
  • Import or export redirects;
  • Create groups to organize them.
  • I sell it to you, right?

 

 How to set up a simple redirect?

 

Download the Redirection plugin then install it and activate it on your WordPress site. On the Tools tab of your dashboard, a Redirection sub tab appeared. WordPress Redirection Plugin add a redirection. It directs you to the page that allows you to manage your redirects. To add a redirect, just enter the source URL, and the target URL.

 

Click on Add a redirection and you will have created your first redirection. However, it is possible to go further. Clicking on the gear icon will expand additional options.    

 

WordPress plugin redirection options

 

You can choose where you want to redirect your URL as well as the type of redirection you want. But hey, remember that in 99% of cases, it will make permanent redirects. You can choose the group in which to classify the redirection. By default, the plugin creates a Redirections group and a Modified Posts group.

 

But you can create others in the “Groups” tab, for example if you want to classify your redirects according to the topics of your site. And finally, the “Pos” field allows to specify a priority to the execution of the redirection. The smaller the number, the higher the priority. I advise you not to touch this field, the plugin handles it very well alone.  Once your redirection is created, remember to empty your cache if you use a cache plugin, so that the change is effective. Most of the time, it will not be necessary, but better to plan.

In the Redirections tab, you have access to the list of your redirects and you will find several interesting information:

 

Plugin Redirection: example of redirection

 

  • Type gives you the type of redirection you have set up.
  • URL indicates the source URL and the new one below.
  • Pos allows you to know in which order the redirections are processed.
  • Hits details the number of times the redirection has been triggered.
  • Last Access reveals the last time she was viewed by a visitor.
  • From this list, you can edit, disable or delete a redirect as for articles or WordPress pages, the links to perform these actions appear on the flyover line.

 

How to set up an advanced redirection with regular expressions?

 

Now that we have warmed up, let’s brace things up a bit. The Redirection plugin also makes it possible to set up further redirections, in particular thanks to regular expressions. If these allow to create simple redirects, as explained just before, they will especially allow you to change multiple URLs from a single redirection. I propose to discover how to use a practical case. Suppose you have a cooking recipe blog. You have created a category “Desserts”, but for a reason that belongs to you, you decide to rename it “Sweet”. If you have chosen a permalink structure of this kind https://votre-site/categorie/nom-article, all the URLs of your articles will be modified and will therefore send your visitors to 404 pages. If you are motivated and have time to spare, you can manually create all redirects for your articles, but there is a much faster solution yes, regular expressions. You can create a regular expression that turns all URLs /desserts/nom-articleinto URLs /sucre/nom-article.

 

How it works?

 

In source URL, specify: https://votre-site/desserts/ (.*) and do not forget to check the Regex box, otherwise your regular expression will not work.

 

  • WordPress redirection regular expression
  • We could also write it like this.

 

The first line is used to search for all the expressions that begin with https://votre-site./desserts/, regardless of the characters that are behind it, and the second line indicates that they must be replaced by this expression https://votre-site/sucre/.

 

You can validate! All the URLs of your articles are modified automatically. Easy and fast, right? Regular expressions are a delicate little gymnastics to take in hand. But once you master them, they allow you to create complex and powerful redirects. Here are some resources if you want to learn more about it. It’s your turn!

 

  • An article from WP Engine.
  • A focus on regular expressions and a memento about it, by Open Classrooms.
  • Another tutorial on regular expressions.
  • A site to test your expressions live

LEAVE A REPLY

Please enter your comment!
Please enter your name here