0

I'm working on a new top-level domain, and redirect visitors of the new domain to the old one, except for my own work on the staging server:

I have a rule that rewrites the host if you don't hit the staging server, which works like a bomb.

if ($host != 'staging.xxx.com') {
  rewrite ^/(.*)$ http://xxx.co.za/$1 permanent;
}

the problem is that some callback from another site we are using is hitting xxx.com/s/callback. At the moment that is redirecting to the .co.za site, but I really want it to redirect to the staging server.

I have added the following ontop of the previous bit of code:

location ~ /s/ {
  rewrite ^/(.*)$ http://staging.xxx.com/$1 permanent;
}

But this doesn't seem to catch the callback, i.e. if I visit xxx.com/s/callback it still redirects to .co.za.

Can anyone describe how to nest those location and if statements, please?

Thank you!

rdrey
  • 103
  • 5

1 Answers1

0

I think your doing it right, and are most likely seeing cache problems while your working on it...

Change "permanent" to "redirect" for now, and also add a line like: expires epoch;

while your testing to stop the browser from caching

Best,

-Eric

Eric
  • 160
  • 8