Redirects and the 404 log
Last updated
A redirect sends visitors and search engines from an old address to a new one. Without one, anyone following an old link or bookmark lands on a "page not found" error, called a 404. Search engines also lose track of the page, and it can drop out of results.
The Redirects module lets you add redirect rules, adds them automatically when a page changes address, and keeps a 404 log of addresses visitors asked for that do not exist, so you can fix them in one click.
Switching Redirects on
Open the site page in MaintainHQ and choose SEO, then Redirects. Press "Install and switch on Redirects" (or "Switch on Redirects" if Site Tools is already installed).
If you used to add redirects from the WP tools page in MaintainHQ, they move over when you switch the module on. Any that would loop, chain or clash with another rule arrive switched off, and are listed for you to check.
Once on, the screen has four tabs: Redirects, 404 log, Import and export, and Settings. In WordPress, the same screens are under Tools, Redirects.
Adding a redirect
- Press "Add redirect".
- Old path: the address that should redirect, for example /old-page.
- Match: choose how the old path is matched (see below).
- Status: choose the kind of redirect (see below).
- New URL: where to send people, for example /new-page or a full address starting https://. Not needed for 410 Gone.
- Set the two switches and add notes if you like, then press "Save redirect".
| Match | What it does |
|---|---|
| Exact path | Only this one address. |
| Path and everything under it | This address and every address that starts with it, for example /blog and /blog/any-post. |
| Regex | A pattern for advanced users. Only shown when regex rules are allowed in Settings. |
| Status | When to use it |
|---|---|
| 301 Moved permanently | The page has moved for good. The usual choice, and best for search rankings. |
| 302 Found (temporary) | The page is elsewhere for a short time and will come back. |
| 307 Temporary | A temporary move that keeps the request method. Rarely needed. |
| 308 Permanent | A permanent move that keeps the request method. Rarely needed. |
| 410 Gone | The page has been removed on purpose and has no replacement. |
The two switches
- Keep the query string (on by default): anything after a ? in the old address is added to the new one, so tracking tags survive.
- Redirect even if a page exists at the old path: normally a rule only acts when the old address would otherwise be a 404, so a rule never hides a real page. Switch this on if you want the redirect to win anyway.
Matching ignores upper and lower case.
Safety checks and automatic redirects
Redirects refuses rules that would cause problems, and tells you why:
- A rule that points at itself.
- A loop, where rules send visitors round in a circle.
- A chain longer than three hops (A to B to C to D).
- Rules that touch /wp-admin, /wp-login.php or /wp-json, so you can never lock yourself out of WordPress.
When a published page or post changes address, a 301 is added automatically, and older rules that pointed at the old address are re-pointed to the new one so there are no chains. You can switch this off in Settings. Automatic rules show "Page moved" in the Origin column.
Managing your rules
The Redirects tab lists your rules with Old path, New URL, Status, Origin (Manual, Imported, Page moved or Gus), Hits and an On switch. Use the switch to pause a rule without deleting it, the pencil to edit, and the bin to delete.
The list shows the first 200 rules. Use "Search redirects" to find others.
If some imported rules are still switched off, a notice says how many, with a "Switch them all on" button. It switches on every imported rule on the site, not just the ones on screen.
The 404 log
The 404 log lists addresses visitors asked for that do not exist, most requested first, with Requests, Last seen and Came from (the page that linked to it). Press "Create redirect" on any row to open the add redirect form with the old path filled in.
- There is one row per address, so a busy broken link does not flood the log.
- Search engine bots, monitors and asset files (images, scripts and the like) are left out.
- Entries are kept for 90 days, and the log holds up to 5,000 addresses.
- Press "Clear the log" to empty it.
Import and export
"Download CSV" exports every redirect as a spreadsheet file. The export is safe to open in a spreadsheet program.
To import a CSV file, the first row must name the columns: source and target, and optionally match_type, status_code, keep_query, early, enabled and notes. An import can hold up to 5,000 rules. Rows that cannot be imported are listed under Skipped with the reason.
To bring rules over from another plugin, press "Import from Redirection", "Import from Rank Math" or "Import from Yoast SEO Premium". Imported redirects start switched off so you can check them first.
If one of these plugins is active, the Redirects screen can also import its rules and switch it off for you. See taking over from a plugin you already use.
Settings and switching off
| Setting | What it does |
|---|---|
| Add a redirect automatically when a published page or post changes address | Creates the 301s described above. |
| Log 404s | Keeps the 404 log. |
| Leave search engine bots and monitors out of the 404 log | Keeps the log to real visitors. |
| Allow regex rules (for advanced users) | Shows the Regex match type. |
"Switch Redirects off" stops your redirects working but keeps them. "Remove all redirect data" deletes every redirect and the 404 log on the site, after you type REMOVE.