How to Set up 301 Redirects in WordPress | Step-By-Step

Published: 25 July 2024
on channel: Hostinger Academy
1k
26

Learn how to set up 301 redirects in WordPress! Boost your online presence with Hostinger’s managed WordPress hosting today
Use the discount code WP10 to get 10% OFF!

Whether you're reorganizing your entire site or updating its URL structure, setting up 301 redirects ensures that your site visitors won’t be left in the dark.
In this video, you’ll be guided through the easiest ways how to set up 301 redirects in WordPress.
____________________________________________

Get Our eBooks!
7-Day WordPress Course:
Build Your First Website in 9 Easy Steps:
____________________________________________

Handy Links
Hostinger Tutorial – How to Set Up 301 Redirects in WordPress and When You Need Them:
TOP 8 WordPress AI Plugins to Manage Your Website Efficiently:
Managed WordPress Hosting Explained:
Join the Hostinger Affiliate Program:
____________________________________________

Follow Us
TikTok:
Instagram:
Twitter:
Facebook:
Hostinger Tutorials:
Subscribe to our channel:
____________________________________________

Timestamps
00:00 - Introduction
How to Set Up 301 Redirects in WordPress
01:00 - Set Up 301 Redirects Using hPanel
01:43 - Set Up 301 Redirects Using the AIOSEO Plugin
02:21 - Set Up 301 Redirects Manually by Editing the .htaccess File
03:51 - Set Up 301 Redirects Using a PHP Script
___________________________________________

When reorganizing your entire site or updating its URL structure, setting up a 301 redirect can help maintain your site’s SEO and user experience.
Fortunately, implementing it on your site requires just a few simple steps.
In this video, you’ll see the video tutorial on how to set up 301 redirects in WordPress websites, starting from the simplest to the most advanced methods:
Set Up 301 Redirects Using hPanel
Set Up 301 Redirects Using the AIOSEO Plugin
Set Up 301 Redirects Manually by Editing the .htaccess File
Here’s the code block you should put below the REWRITE ENGINE ON line:
Redirect 301 /old-url/
Don’t forget to replace /old-url/ with the source URL and with the target URL.
Alternatively, you can use this .htaccess redirect to move your old website to a new domain:
RewriteCond %{HTTP_HOST} ^olddomain.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.olddomain.com [NC]
RewriteRule ^(.*)$ [L,R=301,NC]
Make sure to replace both olddomain.com and newdomain.com with your site’s domain names.
Set Up 301 Redirects Using a PHP Script

Copy this code block to your new .php file:
?php
header("HTTP/1.1 301 Moved Permanently");
header("Location:
exit();
?
Remember to replace with the new URL you want to redirect to.
___________________________________________

▶ Want to see more awesome tutorials like this in the future? Consider subscribing

____________________________________________

Thank you for watching! Let us know in the comments below if you have any questions. Good luck on your online journey.


Watch video How to Set up 301 Redirects in WordPress | Step-By-Step online without registration, duration 05 minute 17 second in high hd quality. This video was added by user Hostinger Academy 25 July 2024, don't forget to share it with your friends and acquaintances, it has been viewed on our site 1 thousand once and liked it 2 people.