惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
Docker
Microsoft Azure Blog
Microsoft Azure Blog
云风的 BLOG
云风的 BLOG
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
L
LangChain Blog
P
Privacy & Cybersecurity Law Blog
Hugging Face - Blog
Hugging Face - Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
大猫的无限游戏
大猫的无限游戏
Cyberwarzone
Cyberwarzone
The Register - Security
The Register - Security
Stack Overflow Blog
Stack Overflow Blog
A
Arctic Wolf
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
T
Threatpost
The GitHub Blog
The GitHub Blog
P
Privacy International News Feed
WordPress大学
WordPress大学
U
Unit 42
S
Securelist
T
The Exploit Database - CXSecurity.com
C
Cyber Attacks, Cyber Crime and Cyber Security
P
Proofpoint News Feed
Latest news
Latest news
Hacker News: Ask HN
Hacker News: Ask HN
小众软件
小众软件
Know Your Adversary
Know Your Adversary
The Cloudflare Blog
V
Vulnerabilities – Threatpost
The Hacker News
The Hacker News
Scott Helme
Scott Helme
有赞技术团队
有赞技术团队
Security Latest
Security Latest
Google DeepMind News
Google DeepMind News
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Simon Willison's Weblog
Simon Willison's Weblog
博客园 - Franky
Y
Y Combinator Blog
博客园 - 叶小钗
Security Archives - TechRepublic
Security Archives - TechRepublic
Google DeepMind News
Google DeepMind News
N
Netflix TechBlog - Medium
S
Secure Thoughts
T
Threat Research - Cisco Blogs
aimingoo的专栏
aimingoo的专栏
S
SegmentFault 最新的问题
Microsoft Security Blog
Microsoft Security Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
博客园 - 司徒正美
M
MIT News - Artificial intelligence

Example blog

Ghost routing explained with routes.yaml examples — routes, collections & taxonomies How to Serve JSON or XML Data in Ghost How to Change Your Default Post Template in Ghost Ghost Custom Theme Settings How to add Google Fonts to Ghost Themes How to Configure Ghost with Mailgun Ghost Theme Structure & Organization How to Make Custom Templates in Ghost Themes How to Install Ghost CMS via Ghost-CLI How to Add Syntax Highlighting to Ghost The best Ghost CMS hosting platforms Ghost 6.0 — Social Web and Native Ghost Analytics Ghost CMS Social web beta, email 2FA and more author social links How to keep custom design settings when updating your Ghost theme How to use the public preview card in Ghost How to add members-specific sections in Ghost How to customize the default content CTA in Ghost How to build a custom homepage in Ghost An overview of Ghost editor cards and and how they work Ghost CMS News: One-time payments & collecting sales tax How to customize the private site access template in Ghost How to add custom fonts in Ghost themes Ghost CMS News: Additional payment methods & internal linking How to use Code Injection in Ghost How to set meta data of your custom routes & collections in Ghost Ghost CMS News: TK reminders, ActivityPub and improvements How to format dates and use the date helper in Ghost Ghost CMS internationalization, custom fonts & spam protection Understanding and optimizing post and page settings in Ghost CMS Trigger the Ghost Portal popup based on page scroll progress How to Deploy Your Ghost Theme with GitHub Actions How to create a custom recommendations page for your Ghost CMS theme Ghost CMS News: New editor, refreshed settings & recommendations Ghost CMS News: Source - the new default theme and native image editing How to Add Different Logos for Dark & Light Themes in Ghost Upgrade to Node v18 for Ghost CMS & common errors Ghost Snippets: Adding Schema markup in Ghost How to add a scroll-based progress bar to your Ghost CMS site How to Create a Custom Navigation Template in Ghost How to Segment Subscribers with Member Labels in Ghost The best way to create a contact page in Ghost How to Use the Ghost Subscription Forms in Your Theme & Posts How to update your Ghost site URL when self-hosting Ghost CMS News: Signup cards and better landing pages How to Add Breadcrumbs to Your Ghost Theme How to integrate the Applause Button into your Ghost theme How to Hide a Post From the Home Page in Ghost CMS Ghost CMS block and contentFor helper overview & tips How to add Image Lightbox to Ghost Themes Ghost CMS News: Signup form embed, new editor and bulk actions. Biron Themes becomes Bright Themes 🎉 How to Audit & Test a Ghost Theme How to Create Related Posts Section in Ghost How to Use Ghost Filter Expressions Ghost CMS newsletter settings and post analytics How to Update Your Ghost Theme When We Release New Versions Ghost CMS News: Automatic list cleaning & email troubleshooting How to Create a Featured Post Slider in Ghost How to Add Reading Time to Ghost Blog Posts How to Create a Post Archive for Your Ghost Theme Ghost CMS Price Helper Overview & Tips Self-Hosted Ghost CMS with DigitalOcean Ghost CMS News: Member Growth Sources & Audience Feedback How to Open External Links in a New Tab in Ghost How to Integrate Google Analytics with Ghost Ghost CMS News: History Log & Newsletter Analytics How to Automatically Add Member Labels From Referral Traffic in Ghost? Ghost CMS News: Free trials & email notifications Ghost CMS Match Helper Usage & Tips Ghost CMS News: Native Comments Ghost CMS News: Ghost Explore & Premium Newsletter Previews Ghost Snippets: Custom Progress Cards & Steps Ghost CMS News: Native Search The Best Ghost CMS Search Plugins & Libraries Ghost Snippets: Custom Stylish Tables How to Add a Scroll Top & Progress Indicator Button in Ghost Ghost Snippets: Accordions How to Add Tag Dropdown to Your Ghost Theme Ghost 5.0 released 🎉 Ghost Snippets: Custom Subscribe Forms Ghost Snippets: Custom Alert Boxes How to Show Post or Newsletter Issue Number in Ghost How to Self-Host Google Fonts in Ghost CMS Ghost CMS News: Membership, Tiers & Activity Feed Custom Pages in Ghost CMS Themes Ghost CMS Search Using Fuse.js Ghost CMS News: Offers and Discounts & New Cards Ghost CMS News: Membership tiers, email CTA & filters Ghost CMS News: Grammarly Support & Feature Image Captions. Ghost CMS News: Improved Member Accounts & Personalized Newsletter. Ghost 4.0 Launched With Native Newsletters & Membership Ghost CMS News: Cancellation Feedback & Newsletter Stats. Ghost CMS News: Improved Member Dashboard & Sidebar Views. Ghost CMS News: Google Pay support, email newsletters & secondary navigation Ghost CMS News: Member Support, Portal & Content Snippets. Ghost CMS News: Referral Programs & Responsive Images. Ghost Themes as Progressive Web Apps Ghost 3.0 is here with brand new features Ghost 2.0 is here with new features How to Add Search to Ghost Using ghostHunter
Ghost redirects explained with practical redirects.yaml examples
Bright Themes · 2026-03-29 · via Example blog

In short: Ghost stores URL redirects in redirects.yaml. You download and upload it from Settings » Labs, same workflow as routes.yaml. Redirects forward old paths to new ones (or to external URLs); they complement—but do not replace—DNS/HTTPS configuration and dynamic routing for how Ghost builds URLs. For authoritative syntax details, see Ghost’s Implementing redirects tutorial.

What Ghost redirects are for

Visitors, newsletters, and search engines accumulate links to exact paths. When you rename a post, migrate from another CMS, or change permalink structure (often via routes.yaml), those links break unless you map old paths to new ones.

  • 301 (permanent) — Tells clients and search engines the resource has moved for good; passes most ranking signals to the destination. Use for migrations and finalized URL changes.
  • 302 (temporary) — Use for short-lived moves or A/B style tests where the old URL may return.

Redirects fix paths on your Ghost site (and can target external URLs). They do not replace server-level or DNS work for apex domains, www, or TLS.

Access and file format

  1. In Ghost Admin, open Settings » Labs.
  2. Download the current redirects.yaml (or create a new file named redirects.yaml if none exists yet).
  3. Edit in a text editor (YAML; spaces for indentation, not tabs).
  4. Upload the file again.

Older Ghost installs may still have JSON redirects; YAML is what you should use for new rules. A brand-new publication starts with no redirects.

Structure of redirects.yaml

The file has two top-level keys: 301 and 302. Under each, list pairs of source: destination (path only for internal targets—no domain):

301:
  /old-post-slug/: /new-post-slug/
  /another-from/: /another-to/

302:
  /temporary-source/: /temporary-destination/

Trailing slashes: Ghost enforces trailing slashes in many setups. Match the style your site actually uses when you write rules, and test both with and without a slash if something does not fire.

Removing all redirects: Uploading an empty file clears every redirect:

301:

302:

Use that only when you intend to wipe the list (Ghost’s documented behavior).

301 vs 302 — which to use

CodeTypical use
301Slug changes, migration from WordPress/Medium/Substack, consolidating duplicate URLs, moving /articles/ to /blog/
302Short maintenance moves, campaigns, or anything you expect to revert

When in doubt after a migration, 301 is the usual choice so backlinks and SEO consolidate on the final URL.

Simple redirects examples

  • One post renamed

    301:
      /old-slug/: /new-slug/
    
  • Tag or author URL renamed

    If you changed taxonomy prefixes in routes.yaml or moved a tag’s slug:

    301:
      /tag/old-label/: /tag/new-label/
    
  • External destination

    Ghost supports redirecting to a full URL:

    301:
      /legacy-page/: https://example.com/docs/new-location/
    
  • Multiple legacy URLs to one canonical path

    301:
      /editing-a-post/: /editing/
      /editing-posts/: /editing/
    

When not to use redirects.yaml

Ghost’s own guidance still applies:

  • HTTP/HTTPS and www — Configure at your DNS or reverse proxy (e.g. Caddy, nginx), not in redirects.yaml.
  • Trailing-slash normalization — Ghost already handles common slash behavior; you usually should not add rules only for that.
  • Systematic permalink design — Prefer dynamic routing and routes.yaml (see our Ghost routing guide) to define /blog/, /topic/, collections, and taxonomies. Use redirects to bridge old URLs after you change routing—not as the primary way to design structure.

Regex redirects (bulk and migrations)

Plain paths match one URL each. Regular expressions match many paths at once. Ghost uses ECMAScript (JavaScript) regex. In the destination, $1, $2, … insert captured groups from the pattern.

Warning

Bad regex can cause redirect loops, mass 404s, or accidental matches. Test in staging, use regex101 with ECMAScript flavor, and add one rule at a time when learning.

Strip a path prefix (e.g. /blog/slug//slug/)

Old site served posts under /blog/post-slug/; Ghost now uses root permalinks /{slug}/:

301:
  ^\/blog\/([a-z0-9-]+)\/$: /$1

What it does: Captures the slug after /blog/ and sends the visitor to /{slug}/. Adjust [a-z0-9-]+ if your slugs allow other characters (Unicode, digits-only, etc.).

WordPress-style dated URLs → slug-only

Day and month in path (/2020/03/15/my-post//my-post/):

301:
  ^\/[0-9]{4}\/[0-9]{2}\/[0-9]{2}\/(.*): /$1

Year and month only (/2020/03/my-post//my-post/):

301:
  ^\/[0-9]{4}\/[0-9]{2}\/(.*): /$1

Important: The destination slug in Ghost must match the imported post slug ($1). If WordPress used different slugs than Ghost imports, you may need individual rules or a spreadsheet-driven set of redirects.

Category-style paths → Ghost tags

Many imports map “categories” to tags:

301:
  ^\/category\/(.*): /tag/$1

Ghost’s tutorial uses a similar pattern for /category/slug//tag/slug/.

“Whole section” or old collection path

Redirects match URL paths, not Ghost collection names. If every old URL lived under /articles/ and new URLs live under /blog/ with the same slug:

301:
  ^\/articles\/(.*)$: /blog/$1

If old URLs were /articles/my-post/ and new posts are at root /my-post/:

301:
  ^\/articles\/(.*)$: /$1

Rule order: More specific rules should appear before broader regex if your tooling processes top-to-bottom; when in doubt, test. Avoid one giant regex until simpler rules are exhausted.

Platform snippets (from Ghost’s docs)

Squarespace blog prefix to root slug:

301:
  ^\/blog\/(\S+): /$1

Medium-style ID suffix strip (verify against your real URLs before production):

301:
  ^\/(?!p\/)(.*)(-[0-9a-f]{10,12}): /$1

Substack /p/ handling is nuanced (Ghost also uses /p/ for previews). See Ghost’s full Substack example before copying.

Redirects and routes.yaml together

Changing collections or permalinks in routes.yaml updates new URLs immediately. Existing inbound links still point at old paths. After you deploy new routing:

  1. List old patterns (export from the old CMS, analytics, or Search Console).
  2. Add 301 rules in redirects.yaml from old paths to the new canonical paths.
  3. Upload and test.

Example: you moved the post index from / to /blog/ and kept slugs the same—old /my-post/ might need to become /blog/my-post/ depending on your new permalink; express that explicitly in redirects.

For meta titles and descriptions on routed URLs, see routes metadata and SEO. For a marketing page at / plus posts under /blog/, see building a custom homepage.

Testing and troubleshooting

Quick checks

  • Open an old URL in a private/incognito window (avoids stale browser cache).
  • Use curl -I https://yoursite.com/old-path/ and confirm 301 (or 302) and a sensible Location: header.
  • Spot-check high-traffic URLs from analytics or backlinks.

Common issues

  • Wrong slash — Source or target missing / at the end vs your live permalinks.
  • Regex too greedy(.*) matches more than you intended; narrow the pattern or anchor with ^ and $.
  • Conflicting rules — Two rules matching the same path; simplify and retest.
  • CDN cache — Edge caches may briefly serve old responses after you change redirects.

Quick checklist

  1. Prefer 301 for permanent migrations.
  2. Edit redirects.yaml in Labs; keep YAML valid.
  3. Start with literal rules; add regex when you need bulk mapping.
  4. Test with curl or incognito before relying on search engines updating.

This guide is a practical companion to Ghost’s Implementing redirects tutorial. For URL structure itself, read Ghost dynamic routing and routes.yaml. Changing domains involves DNS and Ghost config as well—see updating your Ghost site URL. For collection filters that affect where posts appear (not redirects), see Ghost filter expressions.