Applies to: WordPress 7.1 with the Redirection plugin 5.10, or Apache/LiteSpeed .htaccess
A redirect sends visitors and search engines from an old address to a new one, for example after you change a post’s URL, delete a page or restructure your site. Use a 301 (permanent) redirect so search engines move the old page’s ranking to the new one.
Option 1: the Redirection plugin (no code)
- In WordPress, go to Plugins › Add Plugin, search for Redirection (by John Godley), install and activate it. With WP-CLI:
wp plugin install redirection --activate. We tested version 5.10.1 on WordPress 7.1.2. - Open Tools › Redirection and complete the short setup.
- Click Add New: enter the Source URL (the old path, for example
/old-page/) and the Target URL (the new page), and save. It uses a 301 by default.
The plugin can also log 404 errors, so you can see which old links need a redirect, and create redirects automatically when you change a post’s permalink.
Option 2: .htaccess (Apache and LiteSpeed hosting)
Add rules above the # BEGIN WordPress block in .htaccess, so WordPress updates don’t overwrite them:
Redirect 301 /old-page/ https://example.com/new-page/ RedirectMatch 301 ^/blog/(.*)$ https://example.com/news/$1
The first line redirects one page; the second moves a whole section and keeps the rest of the path. Test with curl -I https://example.com/old-page/, which should show 301 and the new Location.
Good practice
- Redirect to the most similar page, not everything to the home page.
- Avoid chains (A to B to C): point old addresses straight to the final page.
- Keep redirects in place for at least a year; longer is better.
Moving the whole site to a new domain: forward visitors to a new domain. More .htaccess redirects: URL redirection.
Ucartz services for this topic
- Web hosting: shared hosting on Virtualmin with NVMe storage, free SSL and email.
- Managed cPanel VPS: cPanel included; we handle updates, security and monitoring.
- Hire an expert: engineers per 15 minutes, per hour or per month, with no contract.
