Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yaf_Response_Abstract::setRedirect 是302重定向,不是301 #117

Open
chenliq opened this issue Aug 15, 2014 · 2 comments
Open

Yaf_Response_Abstract::setRedirect 是302重定向,不是301 #117

chenliq opened this issue Aug 15, 2014 · 2 comments

Comments

@chenliq
Copy link

chenliq commented Aug 15, 2014

Yaf_Response_Abstract::setRedirect
注意
和Yaf_Controller_Abstract::forward不同, 这个重定向是HTTP 301重定向
手册是说301重定向,但是实际却是302重定向的

@Mrhyuan
Copy link

Mrhyuan commented Aug 15, 2014

如果没有添加301HEADER 默认发送的的确是302
这个不是因为yaf遗漏造成的 而是yaf只是用了LOCALTION: XXXXXXX 来REDIRECT
而没有添加301的HEADER LOCATION的默认CODE 就是302
如果需要301 请自己在REDIRECT前添加
Header("HTTP/1.1 301 Moved Permanently");
或者SETHEADER方法(YAF里有)
当然你也可以修改源代码解决这个问题 让YAF自始至终都是301

@chenliq
Copy link
Author

chenliq commented Oct 23, 2014

我觉得手册就应该描述默认情况下的结果,既然需要自己加header后才是301,不加的情况通常是302,那应该在手册中说明一下,避免误会。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants