WORDPRESS
How to Redirect URLs in WordPress?
Discover how to redirect URLs in WordPress, get the step-by-step details, leading you throughout the process to redirect URLs in WordPress.
One of the most important files to a website is the .htaccess file. Standing for hyptertext access, it stands to reason that you can approve, deny, or redirect access to your site through it. While it may seem intimidating because of how utterly important it is that you don’t do anything wrong, the actual editing of the file to redirect is as simple as can be.
Use your favorite FTP program (likely FileZilla) to get into the root directory of your WordPress installation. Just under the core folders, you should see .htaccess.
Open this in your text or code editor (I personally use Sublime Text).
All you have to do for a WordPress redirect is add in a simple line of code just above the line that reads # BEGIN WordPress.
Redirect 301 / http://elegantthemes.com/
or
Redirect 302 / http://elegantthemes.com/
Note that either of these lines of code will redirect your entire site to the URL specified. If you want to redirect a specific page, post, or URL within your site, you will need to provide it as well as the destination URL. Both can be the relative path (if you’re staying on the same domain) and separated by a single space.
Redirect 301 /blog_post https://www.elegantthemes.com/category/blog_post
or
Redirect 302 /blog_post2.html /category/blog_post2.html
Additionally, you can use conditional logic with regex, too, if you need something more complex. Here is a really awesome list of special redirects you can use that way.
Regardless of which route you choose to enter the redirects, you need to save your .htaccess file as plaintext before you re-upload it to the server.
Read more here.