PHP Question

rdtdtd

Newbie
Joined
Mar 24, 2009
Messages
3
Reaction score
0
Total newb question, but nonetheless here it is. I'm attempting to set up a php redirect to my main site for a URL that my craigslist image ad will link to. I have several different ways to code it already researched, including a simple straight up php redirect and a double meta redirect as I'll be using these to drive traffic to some affiliate programs I'm promoting.

Problem is I have no idea how to program this code into the server for the domain I'll be using for the redirect. Don't really have much in the way of programming experience, so I was wondering if anyone could give me a little tutorial on how to implement this strategy. I use GoDaddy if that helps at all.
 
I'm not sure if I understand the question, but if I understand correctly, it's as simple as placing the code into a .php file, and uploading.

example(index.php):
PHP:
<?php
header('Location: hxxp://xxx.redirecthere.com/');
?>

 
What I'm trying to accomplish is to set up a hosted image that links to a domain that will do a php redirect to my main site. I already know how to create a clickable image ad that will link to a specific domain. The thing I'm not clear on is where to upload the redirect script to to get that specific domain to redirect to my main site. Again, if it helps, I host everything through GoDaddy.
 
Better yet, I found that GoDaddy's tools will allow me to forward a domain using a 301 or 302 redirect, and it will even mask it for me. Two questions:

1. Is this the same as doing a php redirect except I don't have to code it myself or manually upload the .php file to my server?

2. Will GoDaddy's masking take care of problems with my AMs so I don't have to code a double-meta or use some other cloaking technique?
 
You can always check to see if your referrer is blank by creating a php file with the following code:

Code:
<?php
	$refer = $_SERVER['HTTP_REFERER'];	
	if ($refer == ''){
		echo 'Your referrer is <strong>BLANK</strong>, congrats.';
	} else {
		echo 'Your referrer is <strong>'.$refer.'</strong>, try again';
	}
?>

Upload this file to your server and then use your redirect to go to the page. If it gives you a "your referrer is blank" message your redirect is working. If not, you will need to use a different method.

Hope this helps.
 
Last edited:
Upload .htaccess to the root of your domain
PHP:
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) insert new url here/$1 [R=301,L]
 
Back
Top