Skip to content

Instantly share code, notes, and snippets.

@pkarman
Created March 21, 2017 21:22
Show Gist options
  • Select an option

  • Save pkarman/1acba5dcbc6226f17705bc70606e4de8 to your computer and use it in GitHub Desktop.

Select an option

Save pkarman/1acba5dcbc6226f17705bc70606e4de8 to your computer and use it in GitHub Desktop.
nginx rewrite example
Add this line to your main nginx.conf file, inside the main "server" block.
include rewrite-rules;
Then create a file called "rewrite-rules" in the same directory as nginx.conf.
Example:
rewrite /hello/friend http://example.com/friend break;
rewrite ^/hello$ http://example.com/world permanent;
See docs at http://nginx.org/en/docs/http/ngx_http_rewrite_module.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment