5

I have a list of 600 urls. Due to a change in the system the urls will change to a new format. I will have a list with the old urls and corresponding new ones. But how do i 301 redirect all of them?

example:

/news/post-name -> /news/post-name.html
/wordpress/στα-ελληνικά -> /wordpress/sta-ellinika.html (in greek)
/cms/a-big-long-title-with-a-lot-of-te -> /cms/a-big-long-title-with-a-lot-of-text.html

There is no real pattern that could automate the work.

So what is the correct way to redirect all of them?

Jim
  • 410
  • 4
  • 14
  • Are there any valid urls that look like these but don't have a .html at the end? Though to be honest I'm wondering why would you need to change them to that. Archives perhaps? – Sašo May 01 '12 at 20:48

1 Answers1

2

You could use the map module to simplify the nginx configuration somewhat, but you're going to have to write a script to convert your list of URLs into the correct format for nginx. I would suggest generating the map directive into a separate file which is then included by the main configuration.

mgorven
  • 30,615
  • 7
  • 79
  • 122