Z
Z
zvezdopad152015-01-16 01:30:49
Nginx
zvezdopad15, 2015-01-16 01:30:49

How to make a "one-time redirect" in nginx?

on the first call,
site1.ru/1.jpg -> redirect 301 site2.ru/2.jpg
on the second+ call, the redirect should not occur,
tell me the finished version?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vlad Zhivotnev, 2015-01-16
@zvezdopad15

location =/1.jpg {
if ( $cookie_megablah = "" ) {
add_header Set-Cookie megablah=1;
return 301 site2.ru/2.jpg;
}
root ...;
etc;
}
Fix the syntax yourself, I think.

Z
zvezdopad15, 2015-01-16
@zvezdopad15

I couldn't make it myself, can you tell me how it should look like?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question