Redirects

Unfold CMS provides both automatic and manual URL redirect management. Redirects help preserve SEO value when content moves and prevent visitors from hitting dead links.

Automatic Redirects

Slug Change Redirects

When you change a post's URL slug through the admin panel, the CMS automatically creates a 301 redirect from the old URL to the new one. This is handled by the HasSlugHistory trait on the Post model.

No configuration is needed — this works out of the box.

How Automatic Redirects Work

  1. You change a post slug from old-title to new-title
  2. The old slug is saved in the slug history table
  3. When a visitor requests the old URL, the CMS:
    • Checks current slugs first (no match)
    • Checks the slug history (match found)
    • Returns a 301 Permanent Redirect to the new URL

This preserves any search engine ranking the old URL had accumulated.

Manual Redirects

Unfold CMS uses the spatie/laravel-missing-page-redirector package for manual redirect management.

Creating Redirects

Navigate to Settings > SEO > Redirects in the admin panel to manage manual redirects.

Field Description Example
Source URL The old URL path /old-page
Destination URL Where to redirect to /new-page
Status Code HTTP redirect code 301

Redirect Status Codes

Code Type Use Case
301 Permanent Redirect Content permanently moved — passes SEO value
302 Temporary Redirect Content temporarily moved — doesn't pass SEO value

Use 301 for most cases. Use 302 only when the original URL will be restored later.

Redirect Matching

Redirects match against the URL path (not the full URL with domain). For example:

Source Matches
/old-page https://example.com/old-page
/blog/old-post https://example.com/blog/old-post

Bulk Import

For migrating from another CMS with many URLs to redirect, you can import redirects in bulk through the admin panel. The import accepts:

  • Source URL path
  • Destination URL path
  • Status code (defaults to 301)

Redirect Priority

When a URL is requested, the CMS processes redirects in this order:

  1. Current routes — Existing pages and posts are served first
  2. Slug history — Automatic redirects from changed slugs
  3. Manual redirects — Configured through the admin panel
  4. 404 page — If no match is found

This means manual redirects never override existing content.

Best Practices

  1. Use 301 for permanent moves — Tells search engines to transfer ranking to the new URL
  2. Avoid redirect chains — Don't redirect A → B → C; redirect A directly to C
  3. Clean up old redirects — Remove redirects that are no longer needed
  4. Test after creating — Visit the source URL to verify the redirect works
  5. Use relative paths — Enter /old-page instead of https://example.com/old-page

Common Scenarios

Migrating from WordPress

When migrating from WordPress, your old URL structure might differ. Create manual redirects for high-traffic pages:

Old URL (WordPress) New URL (Unfold CMS)
/2025/03/my-post/ /blog/my-post/
/category/tech/ /category/technology/
/?p=123 /blog/actual-post-slug/

Removing a Page

When removing a page, redirect it to a relevant alternative:

Removed Page Redirect To
/old-product /products
/deprecated-feature /new-feature

Domain Change

For domain changes, configure redirects at the web server level (Apache/Nginx) rather than in the CMS.