0

I recently moved a website from a subfolder and I'm having difficulty understanding how to do URL rewrites in NGINX so external links to the website will still work.

Basically, I need links to http://example.com/abc to redirect to http://example.com

This is the first time I've had to deal with this on NGINX so forgive me if this is ridiculously simple to do. Here's what I think I need to put in the NGINX config file:

server {
    listen       80;
    server_name  example.com/abc;
    return       301 http://www.example.com;
}

Am I on the right track?

Jim
  • 1
  • 1
  • Do you want a redirect, or a rewrite? One of them tells the user's browser to go to a different location, and the other serves the content they wanted, but at another location. – psycotica0 Dec 04 '14 at 22:47

1 Answers1

0

If you mean redirect, you should check out https://stackoverflow.com/a/10303879/46842. It's not the same question, but the answer is very similar.

Community
  • 1
  • 1
psycotica0
  • 3,130
  • 2
  • 19
  • 16