简体   繁体   English

缓存 apache mod_write 和 php 标头

[英]Cache apache mod_write and php headers

I'm having a problem with php redirect (header) and mod_rewrite.我遇到了 php 重定向(标题)和 mod_rewrite 的问题。

Here is how:方法如下:

1 - I log into the system and wait time for the session expires. 1 - 我登录系统并等待 session 的时间到期。

2 - I click a link that has any rewriting (mod_rewrite set). 2 - 我单击一个有任何重写(mod_rewrite 集)的链接。 Ex: www.page.com.br/product/25/product-name.html例如: www.page.com.br/product/25/product-name.html

3 - In implementing the above file (products.php), PHP checks that the session expired and redirects to index.php?t=time() via header ("Location"). 3 - In implementing the above file (products.php), PHP checks that the session expired and redirects to index.php?t=time() via header ("Location").

4 - After that, if the user clicks again in www.page.com.br/product/25/product-name.html, mod_rewrite does not rewrite to the correct file (products.php) and maintains a cache that redirects back to index.php?t=time() 4 - 之后,如果用户再次点击 www.page.com.br/product/25/product-name.html,mod_rewrite 不会重写到正确的文件 (products.php) 并维护一个重定向回index.php?t=time()

comments:注释:

This only occurs with links that need rewriting and redirection link that occurred.这只发生在需要重写的链接和发生的重定向链接中。

Add the function time () to make sure it is a cache and no redirects successive proof is that it keeps the t = time () in clicks later添加 function time () 以确保它是缓存并且没有重定向连续证明是它在点击后保持 t = time ()

Someone had this problem, or know of some kind of cache that this mod-rewrite generating this problem?有人遇到过这个问题,或者知道这个 mod-rewrite 产生了这个问题的某种缓存?

thanks Rafael谢谢拉斐尔

Are you doing a 302 or a 301 redirect?你是在做 302 还是 301 重定向? 301 is "moved permanently", which means the browser will automatically go to the 'new' page, without checking for changes. 301 是“永久移动”,这意味着浏览器将自动 go 到“新”页面,而不检查更改。 If you do a 302, it's a "moved temporarily", and the browser will check if the redirect is still in effect each time.如果你做了一个 302,它是一个“临时移动”,浏览器每次都会检查重定向是否仍然有效。

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

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