Question

What are the standards for managing URL redirects if you base your URL's off properties of the data that might change a few times, like the "title"?

I have a website with lots of images and I want to make the urls look like this:

http://www.mySite.com/images/132123/my-cool-image-title

Now say a bunch of people bookmark the image, and a week later I change it to:

http://www.mySite.com/images/132123/renamed-image-title

So now there has to be a redirect for the people that bookmarked the old one... Now lets say that happens on average 3 times per image. That means I'd have lots and lots of redirects to map. I'd have a database of redirects it seems.

What is best practice in this case, assuming I want to use pretty urls and not base it on some universally unique id, and that I'd like to reap as many benefits of SEO as possible?

Was it helpful?

Solution

Well I don't know what the downvote was about, this seems like a perfectly valid question to me.

My recommendation would be that if you know in advance you will be changing the data, it probably shouldn't be in the URL in the first place. If this is a requirement (perhaps its important for SEO or you are creating a blog or something, you have some choices:

  1. Forget the old URL and use only the new. Probably not a good way to make friends ;)
  2. Keep the old URL and accept the fact that the title and URL do not match now. This might be accomplished by each post having a slug field where the URL text is stored, separate to the post's actual title.
  3. Keep the old URL and allow for new ones. A method for doing this might be to have a separate table which maps slugs to posts, each post having one or more slugs. That way, any number of changes are catered for.

If possible changes and backwards compatibility are a requirement, I'd go with something like option 3. Its certainly better to have it built in to your app than have to manage growing .htaccess files full or URL rewrite rules or something.

OTHER TIPS

vote me down if you think my answer is stupid. I do not care it so much.

Not sure if your are using the same approach as StacOverflow, if you do then the slug, in your case my-cool-image-title and renamed-image-titledo not make a big difference as long as you keep the ID 132123 the same. So you need to to worry about your redirect stuff. That being said, in the perspective of social Bookmark users, I think changing slug may cause confusing, but it is not a redirect issue.

Am I wrong?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top