Answer the question
In order to leave comments, you need to log in
How to do rewriting in nginx from folder to folder?
Good day!
It costs Ubuntu Server 14.04.1
It has nginx 1.4.6 + PHP + MySQL + phpMyAdmin deployed on it.
I was given a task to which I must strictly adhere.
Here's the point I'm asking for help here:
You need to make a url rewrite rule so that when you access the
test1 folder , the test2 folder opens .
I created these folders in
/usr/share/nginx/html/ I
created them here, because it was this directory that the server accessed when it received http requests from the outside.
In the same directory there were 2 files:
index.html and 50x.html
For rewriting, I changed the nginx.conf file located in /etc/nginx
Under the "http" tag I added the following:
server {
location = /for/test1 {
rewrite ^(.*)$ /use/test2/$ break;
}
}
Answer the question
In order to leave comments, you need to log in
The paths specified in the rule do not match the described conditions. Now you have written that you need to overwrite test1 in the for folder. The next line has the same error.
Learn:
nginx.org/ru/docs/http/ngx_http_rewrite_module.html
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question