Reputation: 1143
Hello I'm trying to write a Nginx rewrite rule that adds a subdirectory to my URL if it's missing. For example, I need http://example.com
to be re-written (and redirected) to http://example.com/legacy-app
. Can't seem to find the proper example to do this.
Upvotes: 0
Views: 624
Reputation: 49812
You can use a rewrite
directive, but an exact match location
block is most efficient:
location = / {
return 301 /legacy-app;
}
See this document for more.
Upvotes: 1