How to redirect URLs in WordPress? – Learn WordPress from a to z

Tutorials 0 lượt xem

URL redirection, is a way to make a link accessible under many different addresses. Sometimes you may need to redirect a post, page or link in WordPress. In this article, I will show you how to do that.

How to redirect URLs in WordPress?

Types of URL Redirects

There are many types of URL redirects, but in this article I will introduce 2 basic types: 301 and 302 redirects.

301 redirect

301 is the most common redirect, used when you want to permanently redirect a URL. The reason it’s most popular is because it won’t affect the ranking of the URL, and inherits the full power of SEO from the old URL.

302 Redirection

302 is a temporary redirect. Used when you are updating the website. Or customers are reviewing your website and you don’t want it included in search engine rankings.

Use the Simple 301 Redirects plugin

Simple 301 Redirects is the most popular URL redirect management plugin for WordPress. This is the simplest way to do URL redirection without any programming knowledge.

First, install and activate the plugin. Once installed, go to Settings > 301 Redirects .

Interface 301 Redirects

With  Request being the old URL. And Destination is the new URL you want to replace. And as the name implies, this plugin will help you set up 301 redirects in the simplest way.

Using the .htaccess file

If you want to use the .htaccess file to redirect a URL, you should have some programming knowledge. Because of just one small mistake here, it will make your entire website inaccessible.

Please add the below code at the end of your .htaccess file

RewriteEngine On
Redirect 301 /old-url/ http://yoursite.com/new-url
<div>
<span>1</span><span>2</span>
</div>

Please replace the above URL with your own URL. With other URLs you can do the same.

Epilogue

I hope you can apply this trick in the process of developing a website. Especially when you need to redirect a line in WordPress.

If you found this article useful, please comment and share this article. In addition, you can follow the WordPress Tips section and follow Facebook for more new knowledge.

Bài viết liên quan