I have a blog hosted at http://site.com/blog.
How do I instruct nginx to rewrite requests from site.com
to site.com/blog
?
This should not be permanent.
I have a blog hosted at http://site.com/blog.
How do I instruct nginx to rewrite requests from site.com
to site.com/blog
?
This should not be permanent.
This'll just do requests specifically for the root. If you need to catch everything (redirect
http://site.com/somearticle/something.html
tohttp://site.com/blog/somearticle/something.html
), then you'll need something more involved:try this instead:
The key here is '=' symbol.
This has not worked for me. This is what has worked:
Open the NGINX configuration file for your site. Inside of the server block, add the path to your root directory and set the priority order for files:
Create an empty location block before all your other location blocks:
Comment out the root directory directive in your location / {} block and add the redirection so it looks like this:
Make sure that your location ~ .php$ block points its root to
This fixed it for me.
for the just the home page and nothing else, i would use:
anything else, like /foo/ would not be redirected to /blog/ .