=== RB Links Redirection ===
Contributors: rbplugins
Tags: redirect, 301 redirect, 404, redirection, broken links
Requires at least: 6.2
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

301, 302, 303, 307, 308 and 410 redirects, a 404 log with one-click fixes, and automatic redirects when a post's address changes.

== Description ==

[📄 Details](https://rbplugins.com/wordpress-plugins/rb-links-redirection/) | [📖 Documentation](https://rbplugins.com/docs/rb-links-redirection/)

**RB Links Redirection** sends old and broken addresses to the right page. Add a redirect in seconds, see which links lead nowhere in the 404 log, and never lose a visitor when you rename a page.

= Redirects =

* **301, 302, 303, 307 and 308** redirects, and **410 Gone** for pages removed on purpose
* **Four kinds of rules:** the exact address, addresses that **start with** or **contain** a text, and **regular expressions** with `$1`, `$2` in the target
* **Redirect to a post:** pick a post or page as the target, and the redirect follows it even when its address changes
* Letter case and a trailing slash do not matter: `/Old-Page/` and `/old-page` are the same address
* The **query string goes along** (`/old?utm_source=mail` → `/new?utm_source=mail`), so campaign tracking survives
* **Hit counter** and the time of the last hit for every redirect
* **Test an address** before you save: see exactly where a visitor would go
* Enable, disable and delete redirects one by one or in bulk; search and filter the list

= Automatic redirects =

* **A post's address changes** — a new slug, a new parent page, a different permalink date — and the old address keeps working with a 301 to the post
* **Subpages move with their page:** one rule covers the whole branch
* Changing the address back never makes a loop: the old redirect is removed

= 404 log =

* Every address that ends in "not found", once, with **hits, last visit and where visitors came from**
* **One click turns a dead link into a redirect;** fixed addresses are marked
* Browser noise (favicon, touch icons) is left out; old entries are forgotten after a number of days you choose
* Optionally send every other 404 to the **home page** or an address of your choice

= Import and export =

* **CSV** in both directions: `source, target, code, match_type, enabled, note`
* Importing the same file twice adds nothing twice

= For developers =

* `rb_redirection_add( '/old', '/new', 301, array( 'origin' => 'my-plugin' ) )` and `rb_redirection_find( '/old' )`
* Actions `rb_redirection_added`, `rb_redirection_before_redirect`; filters `rb_redirection_capability`, `rb_redirection_ignore_404`
* REST API under `rb_redirection/v1`

Fast: exact addresses are found by an index in a single query, pattern rules are cached. Works on Multisite — every site has its own redirects.

Works with **Duplicate Post RB**: when its cleanup removes duplicate posts, their addresses can redirect to the post that stays.

== Installation ==

1. Install from Plugins → Add New, or upload the `rb-links-redirection` folder to `/wp-content/plugins/`.
2. Activate the plugin.
3. Open **RB Plugins → Links Redirection**.

== Frequently Asked Questions ==

= 301 or 302? =

301 when a page moved for good: search engines move its ranking to the new address. 302 or 307 for a short time, like a seasonal sale page.

= What is 410? =

"Gone": the page was removed on purpose and will not come back. Search engines drop it faster than a 404.

= Can I redirect a whole section? =

Yes: a "Starts with" rule for `/old-blog/`, or a regular expression `^/old-blog/(.*)$` with the target `/blog/$1` to keep the rest of the address.

= Will redirects slow my site down? =

No. An exact address is found by a database index in one query, and the few pattern rules are cached.

= Are the admin, the login page and the REST API safe? =

Yes, they are never redirected, so a broad rule cannot lock you out.

= What happens when I delete the plugin? =

Its tables, settings and schedule are removed, on every site of a network. Deactivating keeps everything.

== Screenshots ==

1. Redirects: rules, codes, hits, test an address
2. Add a redirect: an address, a post, or a pattern
3. The 404 log with one-click fixes
4. Settings

== Changelog ==

= 1.0.0 (26-10-2026) =
* First release: redirects with exact, starts-with, contains and regular-expression rules; 301, 302, 303, 307, 308 and 410; redirects to posts that follow their address; automatic redirects when a post's address changes; 404 log; 404 fallback; CSV import and export; hit counter; REST API and PHP functions.
