0

I have about 250 URLS that need to be redirected from an old site to new. In the server block I set this statement:

include /etc/nginx/301s/somesite.conf;

Then in the included file I have a list of the urls (shown are four of them):

location = /programs-services/ { return 301 https://www.somesite.com/ }
location = /meeting-planner/ { return 301 https://www.somesite.com/speaker-kit/ }
location = /media/ { return 301 https://www.somesite.com/ }
location = /research-fund/ { return 301 https://www.somesite.com/about/ }

However, Nginx won't restart and complains:

unexpected "}" at the end of the first line.

Is there a better / correct way to implement this?

1 Answer 1

3

I don't know of a better way, although I too would like to, but your configuration is broken due to missing ; after return directive.

location = /programs-services/ { return 301 https://www.somesite.com/; }
location = /meeting-planner/ { return 301 https://www.somesite.com/speaker-kit/; }
3
  • This answer might also be of interest: serverfault.com/a/441517/405852
    – virullius
    Jan 4, 2018 at 17:57
  • Both good answers, but I can get neither to work properly, Nginx complains about Unregistered Authentication Agent
    – gigaboy
    Jan 4, 2018 at 20:03
  • That is not an nginx error. It appears to be a PolicyKit error.
    – virullius
    Jan 4, 2018 at 21:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .