Home  >  Q&A  >  body text

nginx file redirection problem

The original address is http://aaa.com/aaa.swf

The new address is http://bbb.com/bbb (no .swf, the program automatically loads it)

In this case, how can we achieve automatic loading of the new address (not jump) when accessing the source address?

怪我咯怪我咯2712 days ago677

reply all(2)I'll reply

  • 滿天的星座

    滿天的星座2017-05-16 17:30:42

    location ~ ^/aaa.swf {
        root /var/www/bbb.com # the local file path of bbb
        # use rewrite to map aaa.swf to bbb
    }
    

    reply
    0
  • 仅有的幸福

    仅有的幸福2017-05-16 17:30:42

    If they are not on the same host, it can be achieved through a reverse proxy

    Add the following statement in the bbb.comserver {} block.

    location / { 
        if ($uri = /bbb)
        {   
            rewrite ^/bbb$ /aaa.swf break;
            proxy_pass http://aaa.com;
        }   
    }   
    

    reply
    0
  • Cancelreply