Reputation: 2344
I need redirect 2 link to same folder, ex.
www.domain.com ---> /path/to/files
www.domain.com/foo ---> /path/to/files
I have tried with "location" but don't work:
server {
listen 81;
server_name domain.com;
index index.php index.html;
root /path/to/files;
location /foo {
root /path/to/files;
index index.html;
}
}
Upvotes: 0
Views: 52
Reputation: 14364
location /foo {
alias /path/to/files;
}
or
location /foo/ {
alias /path/to/files/;
}
Be careful with trailing slashes.
See http://nginx.org/r/alias for details.
Upvotes: 1
Reputation: 572
You must use a rewrite:
location /foo {
root /path/to/files;
index index.html;
rewrite ^/foo(/.*|)$ $1 break;
}
Upvotes: 0