简体   繁体   English

PHP / NGINX:301重定向

[英]PHP/NGINX: 301 redirect

I was making a temporary redirect in PHP changing the headers. 我在PHP中进行临时重定向更改标头。

However I'd like to make now a simple 301 page redirection directly in Nginx: 但是,我想在Nginx中直接进行简单的301页面重定向:

http://domain.com/example.php?var=value

to: 至:

http://domain.com/index.htm http://domain.com/index.htm

I tried: 我试过了:

location / {
    index index.htm index.php;
    rewrite example.php?var=value / permanent;
}

But it is not working... 但它不起作用......

Any ideas? 有任何想法吗?

Thanks. 谢谢。

Simply put (out of "location / {}"): 简单地说(在“location / {}”之外):

rewrite /example.php?var=value / permanent;

By the way, PHP has a way to make redirections 301 also. 顺便说一句,PHP还有一种方法可以进行重定向301。

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

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