Advanced web design question

MangoTBG

Diamond Member
Apr 28, 2003
3,101
0
76
What would I need to do to have certain actions, like redirecting, someone who is coming from a link from a specific website (as in domain) or webpage?

I realize this is somewhat vague, if I could be told what the name of what I'm trying to do and a few links then I can read up about it on my own, that would be swell.



Here's an example of what I want to do:

Let's say someone links to my site from myspace.com. I'd like to have it if Johny comes by and clicks on the link from myspace.com, my website then recognizes where Johny has come from and redirects him to a specific place.

 
Oct 19, 2000
17,860
4
81
Originally posted by: MainFramed
I think instead of you setting it up so your website knows where they're coming from you would set the link up from say "myspace" to let your website know its coming from there. I'll have to look at this, i am posting without even looking back at my stuff but just to let you know...I have done this before. just not exactly how your saying it.
The way you've described is stupidly simple, so I'm wondering if the OP is looking for something more dynamic. I'm guessing you're expecting visits from links you've not planted.
 

jfall

Diamond Member
Oct 31, 2000
5,975
2
0
should be able to do that with .htaccess -- or possibly a php script
 

CTho9305

Elite Member
Jul 26, 2000
9,214
1
81
In htdocs/pics/cool, I have a .htaccess that contains the following:
RewriteEngine On
RewriteBase /pics/cool
RewriteCond %{HTTP_REFERER} myspace
RewriteRule ^cst.*jpg$ ../fatbikini.jpg

This checks for accesses to files named "cst[whatever]jpg" and serves up a different image instead.
 

MangoTBG

Diamond Member
Apr 28, 2003
3,101
0
76
I know you can redirect with .htaccess, I know you can also block referrers with .htaccess. But what I'm looking for, I believe is a little more dynamic. I guess since I don't know PHP then that might be a place to start. It's not that I was looking for a simple way to do this, I'm just looking for a little guidance on where to start learning about what I want to do.
 

Skeeedunt

Platinum Member
Oct 7, 2005
2,777
3
76
Pretty much all scripting languages will let you access the the HTTP Referrer, in PHP it's $_SERVER['HTTP_REFERER']; (yes, referrer is misspelled http://us2.php.net/reserved.variables). This will tell you what page directed the person to the current page.

Keep in mind that anybody can fake or alter the Referrer heading that they send, so it shouldn't be trusted for anything.
 

clamum

Lifer
Feb 13, 2003
26,256
406
126
Originally posted by: Skeeedunt
Pretty much all scripting languages will let you access the the HTTP Referrer, in PHP it's $_SERVER['HTTP_REFERER']; (yes, referrer is misspelled http://us2.php.net/reserved.variables). This will tell you what page directed the person to the current page.

Keep in mind that anybody can fake or alter the Referrer heading that they send, so it shouldn't be trusted for anything.

I was gonna post the same thing. It's very easy to access it using PHP (or ASP) but it can be faked so you shouldn't rely on it for important things.