Set-Cookie then Redirect with htaccess
I'm moving a site over from one domain to another. I'd like to detect the referer and to offer an explanation on the new site (e.g. Company X has changed its name to company Y), which I'm doing on searches, but after a 301 redirect the HTTP_REFERER
is blank so I thought of setting a cookie with a short lifespan then red开发者_开发百科irecting. On the new site check if the cookie exists and show the message.
This is what I've come up with:
Header set Set-Cookie "oldsiteredirect=true"
Redirect 301 / http://newsite.com/
The redirect is working fine but no cookie is set. And I'd also like to set the expires as now + 10 seconds.
Is this the way to go or is there a simpler solution out there?
Thanks.
If you just want the new site to "know" that there was a redirect, why don't you use a parameter?
Redirect 301 /
http://newsite.com/?oldsiteredirect=true
精彩评论