Reputation: 1689
Trying to redirect a file in Nginx.conf but unsuccessful. I want to redirect from the directory
/data/file/static/sites/index.html
to
/data/file/static/sites/desktop/index.html
My nginx.conf
server {
listen 80;
server_name test.com;
root /data/file/static/sites;
location /data/file/static/sites/index.html {
rewrite ^(.*)$ /data/file/static/sites/desktop/index.html break;
}
}
Upvotes: 0
Views: 120
Reputation: 71
try this:
location /index.html {
rewrite ^(.*)$ /desktop/index.html break;
}
since you have root /data/file/static/sites;
, you don't need the full path in location.
Upvotes: 1