nginx: redirect root to subdirectory while maintaining url
- www
|- splash
|- blog
www is the root folder.
I would like to redirect users who access http://mysite.com
But I don't want the URL in the address bar to change to http://mysite.com/splash
The URL in the address bar should still be http://mysite.com
This rule should only apply when user accesses the root folder.
Meanwhile accessing the blog folder will be as usual via: http://mysite.com/blog
How do I achieve this? So far my conf is as follow: (they don't work btw)
location / {
root /www;
index index.html;
}
location = / {
root /www/splash;
index index.html;
}
Cheers!
1 Reply
for blog do a location /blog … with a root change
look up the meaning of = with location and see if this is really what you want.
also look what alias means in nginx configs.