patrick-fitzgerald
patrick-fitzgerald

Reputation: 2669

Nginx Rewrite URL Question

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

Upvotes: 0

Views: 1424

Answers (1)

Ben Taitelbaum
Ben Taitelbaum

Reputation: 7403

server {
  listen 80;
  server_name www.example.com;
  rewrite ^(.*)$ $scheme://www.example.com:9000$1 redirect;
}

Upvotes: 1

Related Questions