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?

gigaboy
  • 13
  • 3

1 Answers1

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/; }
virullius
  • 1,048
  • 1
  • 9
  • 23