question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Suggestion: 301 redirects for old post links

See original GitHub issue

This is along the lines of the feature discussed on the roadmap trello board, but with an added wrinkle: I’d like to be able to set a URL that Ghost will listen on to redirect traffic. This is important to me because my old posts (which have been linked elsewhere) have the URL structure /category/year/month/day/title/ and although I can get close with Ghost’s date-in-the-permalink setting I’d like to not break everyone’s links unnecessarily. So basically, the feature request is:

/development/2014/01/01/blah/ -> 301 /2014/01/01/blah/

It’d also be great if changed post titles/URLs would make redirection links, so as to never break a URL.

It might make sense for this to be an app, but it would certainly help ease the transition of popular blogs coming to ghost.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
GaryStantoncommented, Jan 27, 2016

Sure, everywhere a slug can be changed or created in the UI it needs to run through a bunch of functions to check for conflicts and such. I’ve rolled this solution on several applications myself… I’d contend that slug functionality simply shouldn’t exist in an application unless this side of it has been taken care of, otherwise you’re just creating endless 404s every time a user changes a slug. I don’t think you should expect the user to handle this server-side, it can become completely unmanageable very quickly.

My usual solution has a function to check for a slug conflict (presumably something like this exists already, lest two posts end up with the same slug) and deletes any records where the ‘Old’ slug matches our ‘New’ slug - otherwise you can end up in an infinite redirect.

I can’t think of a use case where these redirects should be anything other than 301. If a user renames a slug back, the redirect conflict function takes care of the historical slug, and the redirect from the once new, now old, becomes a 301. ‘Permanent’ in this context is more about intention than timespan.

I have no experience with NodeJS at all, otherwise I’d have a crack at this myself… I might give it a look anyway. 😉

0reactions
harsaharsacommented, Jun 3, 2016

👍 for this!

Read more comments on GitHub >

github_iconTop Results From Across the Web

301 Redirects for SEO: Everything You Need to Know - Ahrefs
301 redirects are pretty simple. They're used to redirect one webpage to another. But understanding how they relate to SEO is more complicated....
Read more >
A Comprehensive SEO Guide to 301 Redirects - SEMrush
A 301 redirect is a permanent redirect that takes users (and search engines) to a new URL when the original page no longer...
Read more >
Beginner's Guide to Creating 301 Redirects in WordPress ...
First, you need to enter the link you'd like to redirect in the Source URL field. After that, you should enter the new...
Read more >
Google: Keep 301 Redirects In Place For A Year
Google says 301 redirects should be kept in place for at least a year to ensure the changes are recognized permanently.
Read more >
How to Get More Traffic from 301 Redirects - Neil Patel
If you rebranded your website, you can use a 301 to direct traffic from your old site to your new one. Jon Morrow...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found