How to prevent loosing the referer after redirect?

hipapatuk

Newbie
Joined
Feb 15, 2008
Messages
34
Reaction score
4
Hey buddies,

im trying like already all day into doing this... but can't and seems impossible. Can someone tell me if it is possible and how can I keep my referer after .htaccess (RewriteRule) or php header redirection? :o

Best,
h
 
Search in this category, there is already an excellent thread about that!

header('Location: bla')

just as teaser
 
Search in this category, there is already an excellent thread about that!

header('Location: bla')

just as teaser


Dude I know that php code and I tried it but it clears the referer. But I want to prevent that. I want to keep my referer. Actually im about to come with a solution, will share it with you guys :rolleyes:
 
Hey buddies,

im trying like already all day into doing this... but can't and seems impossible. Can someone tell me if it is possible and how can I keep my referer after .htaccess (RewriteRule) or php header redirection? :o

Best,
h

javascript is the most reliable way to pass the referer. Using php or meta refresh will blank the referer most the time except in the Safari browser

Something like this should pass the referrer without issue.
Code:
<script type="text/javascript">
<!--
window.location = "http://www.redirect-url.com/"
//-->
</script>

Hope that works for you.
 
Summary of usual behavior:
-Meta clears the referer
-Java location gives the the referer of the bouce page (i.e. the page the code is on)
-PHP Header Redirect gives the referer of the preceding page

These are all to be taken with a grain of salt, as different browsers can behave differently. (e.g. Safari does not clear on meta refresh)
 
Great information guys! You know, I havent been in this section of the forums at all yet! There is just sooo much to learn when you start out as a complete n00b with skills only in cs source. But as for the meta refresh, is it possibly to execute a meta refresh on a forum sit that only allows
 
Great information guys! You know, I havent been in this section of the forums at all yet! There is just sooo much to learn when you start out as a complete n00b with skills only in cs source. But as for the meta refresh, is it possibly to execute a meta refresh on a forum sit that only allows tag? Thanks[/QUOTE]

No, unless there is some major loophole in their CSS (cross site scripting) protection. (Plus, I'm sure that'd piss off a LOT of people)
 
Dude I know that php code and I tried it but it clears the referer. But I want to prevent that. I want to keep my referer. Actually im about to come with a solution, will share it with you guys :rolleyes:


Did you find a solution to pass the referer with htaccess?
 
Unfortunately not. The only way to do it is by using javascript redirection. The code is on already posted on BHW.

I've been reading about a technique where you could pass your referer as querystring attached to your url (with htaccess). then write a script that reads the query.

if I find out how exactly i'll post it here.. :)
 
I've been reading about a technique where you could pass your referer as querystring attached to your url (with htaccess). then write a script that reads the query.

if I find out how exactly i'll post it here.. :)

Sounds interesting although I'm not quite sure if it's possible.. anyways you can always you js.. although I don't know what your project is :)
In my project I couldn't use js.. so I gave up after reading the whole htaccess documentation.. :D
I hope you make it!
 
javascript is the most reliable way to pass the referer. Using php or meta refresh will blank the referer most the time except in the Safari browser

Something like this should pass the referrer without issue.
Code:
<script type="text/javascript">
<!--
window.location = "http://www.redirect-url.com/"
//-->
</script>

Hope that works for you.
This code works fine on FF & Chrome but not on IE, Is there a way to pass the ref or fake the ref with a redirect that works on IE too? Any ideas?
nvm found a way
 
Last edited:
Server side you can't do much, the referer should be set by the browser.
 
with php it works best. referer stays ok.
<?php header('Location: ... ');/* send to site */ ?>
 
I've never heard of any type of HTTP header based redirect not passing referrer in any browser. Last I remember a while ago on here I was doing all kinds of research to try to reliably blank the referrer. Even with Flash it passed.
 
Back
Top