简体   繁体   English

nginx 301永久重定向

[英]nginx 301 permanent redirect

I'm having a difficult time figuring out how should I make a hole bunch of redirects (301) to Nginx. 我很难弄清楚如何将大量重定向(301)重定向到Nginx。 Maybe you can give me some help. 也许您可以给我一些帮助。

Basically I have a few hundred of url's like this one above: http://www.website.com/product/intl/bg-BG/browserchoice/download.html?track=1871 基本上我上面有数百个这样的网址: http : //www.website.com/product/intl/bg-BG/browserchoice/download.html?track=1871

And I need to redirect to: http://www.website.com/home/download/download.php?prod=browser&track=1871 而且我需要重定向到: http : //www.website.com/home/download/download.php? prod=browser&track= 1871

How should I do it? 我该怎么办? (*bg-BG from source is the single variable that changes) (*来源的bg-BG是更改的单个变量)

Please help me. 请帮我。

Thanks. 谢谢。

Please try this, it peforms internal redirect in nginx: 请尝试此操作,它会在nginx中执行内部重定向:

rewrite ^/product/intl/.*/browserchoice/download.html$ /home/download/download.php?prod=browser&$args break;

But if you really want redirect ( this is not a good choice ) : 但是,如果您真的想要重定向( 这不是一个好选择 ):

rewrite ^/product/intl/.*/browserchoice/download.html$ http://www.website.com/home/download/download.php?prod=browser&$args permanent;

I also suggest you to read official documentation here http://wiki.nginx.org/HttpRewriteModule 我也建议您在这里阅读官方文档http://wiki.nginx.org/HttpRewriteModule

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM