Skip to content
Available for new work
Pages in Blog

GuidePremium

Redirects in CoullWorks Blog for Laravel

The Redirects screens of the admin: exact redirects, pattern rules, the 404 log, Test a URL, CSV import and export, 410 Gone, hit counts and the redirects the package makes for you.

Updated 16 November 2026Back to the package pageBuy

A redirect sends an old address to a new one so readers and search engines do not meet a 404. The package makes many redirects for you (when you change a slug, a permalink word, or delete something), and this screen is where you see them, add your own, and deal with the addresses that still return 404.

Redirects is one entry in the sidebar group Search. It opens a cluster with three tabs along the top: Redirects (exact addresses), Pattern rules (one rule for a family of addresses) and Not found (the log of addresses that returned 404). A small badge on the sidebar entry counts the addresses in the 404 log, with the tooltip "Addresses that returned 404". You need the ability blog.redirects.manage. Everything on these screens belongs to the blog chosen in the blog switcher.

The Redirects list#

The Redirects list with four redirects, the All, Moved and Gone tabs and the New redirect, Test a URL and CSV buttons

One row per exact redirect. Notice the status colours (green for permanent moves, red for 410 Gone), the Hits and Last hit columns, and the three tabs with counts above the table.

Tabs, columns and buttons#

  • Tabs: All, Moved (every status except 410) and Gone (410), each with a count badge.
  • Header buttons: New redirect, Test a URL and CSV (which opens a menu with Import a CSV and Export as CSV).
  • Search looks in the old and new paths. A column picker toggles optional columns.
ColumnWhat it shows
Old pathThe address that is redirected. Click the copy icon to copy it.
New addressWhere it goes, or Gone in a grey badge for a 410.
Status301 Moved permanently, 302 Found (temporary), 307 Temporary, keep method, 308 Permanent, keep method or 410 Gone. Green for 301 and 308, amber for 302 and 307, red for 410.
SourceWhere the redirect came from: Manual (you), Slug change (the package, when a slug or permalink changed), Import (an import or a CSV) or Delete (the package, when content was deleted).
HitsHow many times visitors used it. Sortable.
Last hitWhen it was last used, or "Never". Sortable.
CreatedHidden by default.

The Filters panel with Status, Source and the toggle Never hit in 90 days

The funnel icon opens three filters. Never hit in 90 days finds redirects that nobody uses any more.

Filters#

  • Status: one of the five statuses.
  • Source: Slug change, Manual, Import or Delete.
  • Never hit in 90 days: a toggle that shows redirects not used in the last 90 days (or, if never used, older than 90 days). Use it to tidy up. The filters are remembered for your session.

Hit counts#

Each time a visitor is redirected, the redirect's Hits goes up by one and Last hit is set. Counting happens after the response has been sent, in a queued job, so a visitor never waits for it. It is controlled by the configuration key coullworks-blog.redirects.record_hits (on by default); turn it off if you do not want the writes. A visit counts once, even where the host app runs the redirect middleware in more than one place.

The Redirects list with the Hits column showing 3, 9, 41 and 128 and a Last hit time on each row

The Hits and Last hit columns of the demo redirects.

Row actions and bulk actions#

  • Edit opens the edit form. Delete asks "Anyone still using this old address will get a 404 instead." and removes the redirect.
  • Select rows with the checkboxes for Bulk actions:

The Bulk actions menu open over a selected row, with Change status and Delete selected

One row is ticked and the menu offers Change status and Delete selected. Select all and Deselect all appear above the table.

  • Change status asks for a New status and moves each selected redirect to it, keeping its old address. Choosing 410 drops the target. Choosing another status keeps the target; a row that has no target is refused. The result is a notification such as "Status changed on 3" or "Status changed on 2, 1 refused (a redirect needs a target)".
  • Delete selected deletes the selected redirects after a confirmation.

Create or edit a redirect#

The Create Redirect form with an old path that is still a live post, and the amber warning below

The old path /blog/en/a-boot-fitting-checklist is a live post, so an amber warning appears below the fields. It is a warning, not a block: you can still save.

  1. Press New redirect.
  2. Type the Old path, for example /old-stoves.
  3. Either switch Gone (410) on, or type a New path or address and choose a Status.
  4. Press Create. The notification Redirect created has the buttons View and Add another.

Old path#

  • Where: Old address section. Required.
  • Values: a path on this site starting with a slash, at most 512 characters. A full address is reduced to its path. The placeholder is /old-address. Default: none.
  • What it changes: the address that will be redirected. Trailing slashes are ignored.
  • Warning while you type: if it is still a live post, category, tag, author or listing page, an amber message says it is still live and the redirect will do nothing until that page is gone. It never blocks the save, because you may mean to unpublish the page next.
  • Refused when: another redirect already has this old path ("A redirect from [/x] already exists.").

Gone (410)#

  • Where: New address section, a toggle.
  • Values: On or Off. Default: Off.
  • What it changes: On means the page is removed for good with nowhere to send visitors. The address answers 410 Gone, which tells search engines to drop it faster than a 404. The target and status fields disappear while it is on.

New path or address#

  • Where: New address section. Required unless Gone is on.
  • Values: a path on this site, or a full https:// address, at most 2048 characters. The placeholder is /new-address. Default: none.
  • What it changes: where visitors are sent. A target inside this blog that does not match any published page gets a warning: "...does not match a published post, category, tag, author or listing page of the blog, so visitors may land on a 404."
  • Refused when: a redirect would point at itself ("A redirect cannot point to itself.").

Status#

  • Where: New address section, a choice list. Hidden when Gone is on.
  • Values: 301 Moved permanently, 302 Found (temporary), 307 Temporary (keep method), 308 Permanent (keep method). Default: 301.
  • What it changes: the HTTP status of the redirect. Use 301 for a permanent move. 307 and 308 keep the request method, so a POST stays a POST.

The Edit Redirect form for /summer-sale, with Gone (410) switched on and the target fields hidden

Editing an existing redirect. Gone (410) is on, so the New path and Status fields are hidden. Delete is in the page header.

Editing works on the same form. The row changes in place, so its id, creation time and hit count stay. You can switch a redirect to Gone and back.

No chains, no loops#

When you save, the package keeps redirects flat. If other redirects pointed at your old path, they are repointed to your new target, so a visitor never goes through two hops. If another redirect's old path is your new target, that redirect is removed, because that address is live again.

Test a URL#

The Test a URL dialog opened over the Redirects list

The dialog has one field, Address, and a Close button. It opens with the prompt "Type an old address to see what it does."

Press Test a URL, type an old address, and the answer appears under the field as you type. It tells you what a visitor would meet on the active blog:

The Test a URL dialog with /tents typed and the answer: /tents matches an exact redirect: 301 to /blog/en/choose-a-three-season-tent.

Notice that the answer names the layer (an exact redirect) and the status and target.

  • No redirect for /x. It answers whatever the site shows there, or 404. when nothing matches.
  • /x matches an exact redirect: 301 to /y. or /x matches a pattern rule: 301 to /y. Exact redirects are tried first, then rules.
  • /x matches an exact redirect: 410 Gone.
  • If the target is itself redirected, it adds and on to /z, following up to five steps, so you see the address a visitor ends on.

CSV import and export#

The CSV menu open with Import a CSV and Export as CSV

The CSV button is a menu with two items.

Import a CSV#

  1. Prepare a file. One row per redirect. The first row names the columns: from_path and to_path are required, status_code is optional. These names also work for the same columns: from, source, old, old_path, url for the old path; to, target, new, new_path, destination for the target; status, code, type for the status. The old path must start with a slash.
  2. Press CSV, then Import a CSV. The dialog is titled Import redirects.
  3. Choose the CSV file (a .csv or text file up to 2 MB, at most 5000 rows).
  4. Leave Only check, change nothing switched on for the first run. Press Run.
  5. Read the notification, for example Check finished: 4 would be created, 0 updated, 0 unchanged, 0 rows refused. Rows that were refused are listed, up to five, with their line number. When any row is refused the notification stays until you close it.
  6. When the numbers are right, run it again with Only check, change nothing switched off. The notification then reads Import finished: 4 created, ....

The Import redirects dialog with redirects.csv uploaded and Only check, change nothing switched on

The file is uploaded (206 bytes) and the check toggle is on. Notice the dialog repeats the rules: first row names the columns, up to 5000 rows.

The Redirects list after a check run, with the notification Check finished: 4 would be created, 0 updated, 0 unchanged, 0 rows refused

A check run changes nothing. The numbers are exactly what a real run would do, because the check runs the same steps and then undoes them.

Rules of an import: a row with no status gets 301 if it has a target and 410 if not. A row for an old path that already exists updates that redirect (counted as updated, or unchanged if nothing differs). Every row goes through the same checks as a manual redirect, so chains and loops are collapsed. Imported redirects get the source Import.

Export as CSV#

Export as CSV downloads redirects.csv with every redirect of the blog and the columns from_path, to_path, status_code, source, hits, last_hit_at. A cell that starts with =, +, - or @ is prefixed with an apostrophe so a spreadsheet does not run it as a formula. The file imports back in without changes.

Pattern rules#

The Pattern rules list with two rules: /archive/{int}/{slug} to /blog/en/{2} and /category/{slug} to /blog/en/category/{1}

Each row is a pattern, a replacement and a status. The sort handle at the top left of the table lets you drag rows into the order they are tried.

A pattern rule redirects a whole family of old addresses at once, for example every /archive/2019/some-post to the new blog. Rules are tried after exact redirects, in the order shown, and the first that matches wins.

  1. Open the Pattern rules tab and press Add a rule.
  2. Fill the dialog and press Create (or Create & create another).

The Create Pattern Rule dialog with Pattern, Replacement and Status

Both text fields show their placeholders, /old/{int}/{slug} and /new/{1}/{2}.

Pattern#

  • Values: a path of fixed text and placeholders, at most 512 characters. Placeholders: {int} matches digits, {slug} matches letters, digits, dashes and underscores, and {any} matches anything. No regular expressions. Default: none. Required.
  • What it changes: which old addresses the rule catches. /old/{int}/{slug} catches /old/7/boots.
  • Refused when: the pattern is invalid, or another rule already has this pattern.

Replacement#

  • Values: a path starting with a slash, or a full http(s):// address, at most 2048 characters. {1} is the first placeholder of the pattern, {2} the second, and so on. Required.
  • What it changes: where the caught address goes. /old/{int}/{slug} to /new/{1}/{2} sends /old/7/boots to /new/7/boots.
  • Refused when: it uses a number the pattern does not have ("The replacement uses {3} but the pattern has 2 placeholder(s)."), or it matches its own pattern so the rule would loop.

Status#

  • Values: 301, 302, 307 or 308. Default: 301. A rule cannot be 410.

New rules go last. Drag a row (use the sort handle) to change the order. Edit and Delete are in each row; deleting asks "Addresses this rule covered will return 404 unless another redirect matches them." The notifications are Pattern rule added and Pattern rule saved.

The Not found log#

The Not found list with four addresses, their hits, last referrer and last seen time, and Redirect and Dismiss actions

Addresses visitors asked for that nothing answered, most requested first. Notice the "Direct or unknown" grey text where there was no referrer, and the Redirect and Dismiss actions on each row.

The log lists addresses that returned 404 on the blog, with Hits, Last referrer, Last seen and a hidden First seen column. Search finds an address, and the table is sorted by hits.

  • Redirect opens a dialog titled "Redirect /the-address" with Send it to (a path on this site or a full https:// address) and Status (301, 302, 307 or 308). Saving creates the redirect and removes the address from the log.
  • Dismiss removes an address from the log after a confirmation. It comes back if someone asks for it again. Dismiss selected does this for several.

Logging is controlled by coullworks-blog.redirects.log_not_found (on by default). A scan of random addresses cannot fill the table: past coullworks-blog.redirects.not_found_max (5000 per blog) only addresses already logged are counted.

Redirects the package makes for you#

These appear in the list with a Source of Slug change or Delete. You do not have to create them.

What happensWhat the package does
You change a post's slugA 301 from the old address to the new one, source Slug change. In the admin a notification says "Slug changed. A 301 redirect from the old address was created." with an Open redirect button.
You change a category, tag or author slugA 301 from the old address to the new one, in every language of the blog.
You change a permalink word or the address ending in Settings, PermalinksA 301 from every category, tag and author address that moved.
You delete a published postA 410 Gone for each language of the post.
You delete a categoryA 301 to its parent category in the same language, or a 410 Gone if it has no parent.
You delete a tagA 410 Gone.
You delete an authorA 301 to the author who took over the posts, or a 410 Gone if nobody did.

Delete redirects (the last four rows) are controlled by coullworks-blog.redirects.gone_on_delete, on by default. Turn it off if you would rather deleted content simply returns 404. Redirects made by an import, a command or the API are not announced with a notification, because nobody is looking at the panel.

Available for new work

UK based · PHP · Python · JS · TS. Every first call is free.