0

I would like to know how I can achieve the following using the nginx rewrite module, I do not have much experience with regex.

I would like to redirect a URL from

www.example.com/foo/1/bar/2/

rewrite to:

www.example.com:9000/foo/1/bar/2/

thanks

1 Answer 1

1
server {
  listen 80;
  server_name www.example.com;
  rewrite ^(.*)$ $scheme://www.example.com:9000$1 redirect;
}
Sign up to request clarification or add additional context in comments.

1 Comment

You probably want to do this without the "redirect" option so the redirect is internal.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.