Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
    
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 1 '12 at 20:48

1 Answer 1

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.