D
D
da_ladno_vam_chuvaki2020-10-28 13:59:42
Nginx
da_ladno_vam_chuvaki, 2020-10-28 13:59:42

Redirecting from one folder to another nginx?

Hello. There are two folders on the hosting. Conditionally folder1 and folder2. Folder1 contains pictures. I need the user to go to www.site.ru/folder2/image.png and get to www.site.ru/folder1/image.png. Is it possible to make redirects from one folder to another?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2020-10-28
@dodo512

rewrite or alias
rewrite ^/folder2/(.*) /folder1/$1;

location /folder2/ {
    alias /path/to/folder1/;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question