2026年11月12日
2026年11月12日
Redirection Plugin Guide: 301 Redirects, 404 Logs and CSV Import
This article is a localized edition of the Japanese original. Read the Japanese original
Redirection is a plugin that lets you create and manage URL redirects (301, 302 and so on) from the WordPress admin. Redirect rules are stored in the database, so you can send old URLs to new ones without editing .htaccess by hand. It also supports redirect logs, 404 error logs, regex-based bulk redirects and CSV import.
The information in this article was checked against the WordPress.org plugin page and the official documentation (redirection.me) as of November 2026. At that time the latest version was 5.10.1, and it required WordPress 6.7 or later and PHP 7.4 or later. Screen labels are given in English. If your admin is displayed in another language, the wording may differ.
When Redirection is useful
- You changed a post slug or your permalink settings, and the old URLs now return 404
- You restructured your site and need to redirect many URLs at once
- You want to find URLs that return 404 and send them to the right page
- You want to manage redirect rules from the admin without touching
.htaccess
Note that if you only changed a post's slug, WordPress itself records the old slug and redirects to the new URL (wp_old_slug_redirect). Redirection helps when you also need to handle category changes, moved pages and larger site restructures.
Installation and initial setup
In the admin, go to "Plugins → Add New" (プラグイン → 新規追加 in the Japanese UI), search for "Redirection", install it and activate it. With WP-CLI:
wp plugin install redirection --activate
After activation, the plugin screen appears under "Tools → Redirection" (ツール in the Japanese UI). On first use a setup screen asks whether to monitor permalink changes, log redirects and 404s, and record IP addresses. You can change these later on the "Options" tab.
Redirection assumes WordPress permalinks are working correctly. With the default settings it cannot redirect URLs that never reach WordPress (such as static files outside WordPress).
Add a single redirect
- Open "Tools → Redirection" and show the add form on the "Redirects" tab
- Enter the old address in Source URL. Use the path without the domain (for example
/old-page/). It cannot contain anything after# - Enter the destination in Target URL (for example
/new-page/; to send visitors to another domain, start withhttps://) - Click the cog icon to open the advanced settings. There you can set the redirect behavior and HTTP code under When matched, the Group, the Title and more
- Save the redirect
Use 301 for a permanent move and 302 or 307 for a temporary redirect.
| Code | Meaning | When to use it |
|---|---|---|
| 301 | Moved permanently | You changed a URL or merged pages |
| 302 | Temporary redirect | Sending visitors to another page only during a campaign |
| 307 | Temporary redirect (keeps the request method) | Temporarily changing where a form submits |
| 308 | Moved permanently (keeps the request method) | Same use as 301 when you need to keep POST and other methods |
Browsers tend to cache 301 redirects, so if you set one up incorrectly, visitors may keep landing on the old destination for a while after you fix it. One approach is to register the redirect as 302 until you have confirmed the destination, then change it to 301.
Redirect many URLs at once with regular expressions
To redirect by URL pattern, enable the regular expression (Regex) option in the redirect's advanced settings. Without it, the Source URL is treated as a literal URL.
Parts wrapped in parentheses can be used in the Target URL as $1, $2 and so on. The following examples are based on the official documentation.
| Goal | Source URL | Target URL |
|---|---|---|
Send everything under /oldpage/ to /newpage/ |
^/oldpage/(.*) |
/newpage/$1 |
Remove the date from dated permalinks (/2024/05/01/slug/) |
^/\d{4}/\d{2}/\d{2}/(.*) |
/$1 |
| Send every page of an old domain to the same path on a new domain | ^/(.*) |
https://example.com/$1 |
A leading ^ means the redirect only fires when the pattern matches from the start of the URL. Without it, the destination URL can match the pattern again and the redirect can repeat. To match characters that have a special meaning in regex, such as . or ?, escape them as \. and \?.
Import redirects in bulk from CSV
You can register many redirects at once by loading a CSV file on the "Import/Export" tab. According to the official documentation, the columns are:
- Required: column 1 is the source URL, column 2 is the target URL
- Optional: column 3 says whether the source is a regex (
0for no,1for yes), column 4 is the HTTP code (301 to 307 only) - The separator must be a comma (tabs and semicolons are not accepted)
/old-url-1/,/new-url-1/
/old-url-2/,/new-url-2/,0,301
^/category/news/(.*),/news/$1,1,301
Column 3 is the regex flag. If you include an HTTP code, put it in column 4. If you write the code in column 3, as in /old/,/new/,301, the file will not import the way you intended.
Before importing, export your current redirects from the "Import/Export" tab and keep a copy so you can roll back if the import goes wrong.
Check 404 errors and add redirects
If 404 logging is enabled, requests for URLs that don't exist are recorded on the "404s" tab.
- Open "Tools → Redirection → 404s"
- Group the view by URL to see which URLs return 404 most often
- Hover over the row you want to fix, click "Add Redirect" and enter the target URL
Some 404s come from bots probing for URLs that never existed. You don't need to redirect all of them. Prioritize pages that used to exist and URLs that other sites link to.
Track permalink changes automatically
Under URL Monitoring on the "Options" tab, choose which post types to watch (posts, pages, custom post types) and which group should receive the new redirects. When a URL changes, a redirect from the old URL to the new one is created automatically. Redirects can also be created for deleted posts, but according to the official documentation they are created disabled, so you need to add a target and enable them.
Write redirects to Apache’s .htaccess
By default, redirects are handled by WordPress (the WordPress module). This is the method that records hit counts and logs.
If you run Apache, you can also write redirects to .htaccess and let Apache handle them.
- On the "Options" tab, enter the path to your
.htaccessfile in Apache Module. The web server needs permission to write to this file - On the "Groups" tab, create a group that uses the Apache module
- Redirects placed in that group are appended to the configured
.htaccess
Redirects handled by Apache never pass through WordPress, so they are not recorded in Redirection's logs. With Nginx, export the redirects in Nginx format and add them to your server configuration yourself.
Import and export with WP-CLI
Redirection includes WP-CLI commands. The official documentation lists import, export, database actions (database), getting and changing settings (setting) and migrating from other plugins (plugin). There is no command to add or delete individual redirects.
# Import redirects from a CSV file
wp redirection import redirects.csv --format=csv
# Import redirects from .htaccess
wp redirection import .htaccess --format=apache
# Export all redirects as JSON (as a backup)
wp redirection export all redirects-backup.json --format=json
# Print the WordPress module's redirects to the screen in Nginx format
wp redirection export wordpress - --format=nginx
# Migrate redirects from another plugin (example: Rank Math)
wp redirection plugin rank-math
For import, --format accepts csv, apache and json. For export, --format accepts csv, apache, json and nginx.
Operational notes
- Avoid redirect chains: When redirects stack up as A → B → C, pages load more slowly and search engines pass on ranking signals less effectively. When you change a URL again, update older redirects so they point straight to the final URL.
- Watch for redirect loops: If the target matches the source again, the browser shows a "too many redirects" error. Start regex patterns with
^and check that the target does not match the pattern. - Set a log retention period: Logs are stored in the database. Setting the retention period (Log Expiry) on the "Options" tab to something like "A month" lets WP-Cron delete old logs.
- Handling IP addresses: If you keep IP addresses in the logs, make sure this matches your privacy policy. On the "Options" tab you can turn IP logging off or record anonymized addresses.
Related articles
- How to fix 404 errors after a migration
- How to fix the "too many redirects" error
- Setting up an HTTP to HTTPS redirect
Questions about WordPress? The publisher of this site is based in Japan and replies in Japanese. Contact (Japanese)