S
S
Seva2013-10-24 04:03:08
Nginx
Seva, 2013-10-24 04:03:08

Redirects and subdirectories

Good afternoon!

I'm trying to use something like adaptive-images.com on the page, which redirects the images to php, which in turn gives the image the right size.

The trouble is that I use nginx on the server, and I send pictures and other static content through it.

Regarding the server directive in nginx.conf, the page is in the /test directory. How to force nginx to redirect images ONLY FROM THIS DIRECTORY AND BELOW to adaptive-images.php located in the same directory, despite the fact that images from / already go past Apache?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikolai Vasilchuk, 2013-10-24
@Anonym

More or less like this

location @converter {
    rewrite ^/(.+)$ /adaptive-images.php;
}
location ~ ^/test/ {
    try_files $uri @converter;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question