本文介绍了我需要编写的301'd到会话变量的URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

方案:

我有一个链接,是

example/directory/go.php

我301重定向链接到

I am 301 redirecting that link to

example/go.php

我使用一个会话变量来跟踪用户的路径。没有把任何变量在URL中,有没有一种方法,我仍然可以跟踪会话用户去

I use a session variable to track the path of the user. Without putting any variables in the url, is there a way I can still track in the session that the user went to

example/directory/go.php 

或者说打算去那里,但很明显是301'd到

or rather intended to go there but obviously was 301'd to

example/go.php?

现在,当我的var_dump我的会话变量,它总是显示他们参观了为

right now when I var_dump my session variable, it always shows the last page they visited as

example/go.php. 

我的猜测意义,因为它是被重定向与mod_rewrite的,但我只是想看看是否有无论如何,我仍然可以看到我的会话变量,或通过其他方式重定向连接。

which I guess make sense since it is being redirected with mod_rewrite, but I am just trying to see if there is anyway I could still see the redirected link in my session variable or through some other means.

推荐答案

使用mod_rewrite,你可以设置一个cookie以previous URL作为值,然后得到最终的PHP脚本,cookie的值。

Using mod_rewrite you can set a cookie with the previous URL as a value and then get the cookie value in your final PHP script.

这篇关于我需要编写的301'd到会话变量的URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 07:36