Answer the question
In order to leave comments, you need to log in
How to make a unique link (location, nginx)?
I want nginx to work at the link test.ru/m01 as follows:
location / {
if ($host != 'test.ru'){
rewrite (.*) http://test.ru$1 permanent;
}
if ($request_uri ~ /m01$) {
set $root_path $root_path/new;
set $index file.html;
root $root_path;
rewrite ^/(m01)$ /$1/file.html;
}
root $root_path;
index $index;
Answer the question
In order to leave comments, you need to log in
> What I'm doing wrong
About everything.
server {
listen 80 default_server;
return 301 http://test.ru$request_uri;
}
server {
listen 80;
server_name test.ru;
root /path/to/root;
rewrite ^/m[0-6][0-9]$ /new/file.html;
...
}
What am I doing wrong
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question