Need a new web host or having a problem with a script? Tips and advice on the best way to design, build and maintain your most valuable asset - your website!

Don't understand the PHP Redirect

sumo89
Posts: 2
Joined: 28 May 09
Trust:

Don't understand the PHP Redirect

Sorry, I know the PHP Redirect thing is old news to most of guys here but I'm having difficulty understanding how this works based on the video lesson: "How to hide your affiliate link with redirects". I also did a Google search on the topic AND a search on the forums here and the questions I have are just not being addressed.

Here goes:
Say I want to change this: http://example123.rspanish.hop.clickbank.net/
so user sees this: example.com/recommends/rocketspanish/ (http removed)
So I create a php file called index.php that contains only this:

And upload to my site.
This is where all of the instructions I've seen stop. "Just upload it and you're done."

But the instructions say nothing about how to code the link that people actually see on the website.
Do I put the phony link in the html file like this:
//other html code
<a href="http://example.com/recommends/rocketspanish/>rocket spanish</a>
// other html code

But this is a phony link that goes nowhere? How would clicking on this link invoke the code in index.php ?

What if I have several links on my html page, how does the index.php file know which link I'm cloaking?
What if I want to cloak several links in my html file. Do I create a separte index.php file for each link?

It might be easier if someone could post an example: But not just the index.php file, I need to see the whole thing including the html file with more than one link that you would want to cloak. Could be real simple like foo and bar type stuff.

Or please direct me to a place here or on the web that goes beyond just the php file and your done example. Again I already looked here and all I found was the simple create index.php file-upload-done explanation.

Thanks!
  • 0
Last edited by ampie g on 20 Jan 10 2:25 am, edited 1 time in total.
Reason: removed http as link is only used for illustration & not an actual link
 

bd1623
Posts: 1
Joined: 03 May 09
Trust:
Hello Sumo89

A quick answer here.

What you do is create a directory folder on your public_html on your server under recommends called example: rocketspanish You can use ftp program to do this. Go to your public_html locate your domain directory folder called /example. Now inside your domain directory called example you should have another directory folder called /recommends per your example. Now in /recommends directory you create a directory folder called rocketspanish use ftp program to create directory just right click and create directory name it rocketspanish.

example of what you might see. public_html/domain/recommends/ (create directory called rocketspanish here.)

See: domain has a directory folder with index.html
recommends has a directory folder with index.html too, now
rocketspanish (you created inside recommends directory) will not have an index.html yet, right.

You will now place redirect index.html you created earlier in here. now rocketspanish will have an index.html file.

Remember you put your php redirect code inside a notepad and save as index.html This index.html file is the one you're placing inside your rocketspanish directory you created above on your server.

so when you type in example.com/recommends/rocketspanish.html (removed http) people will be sent to product sales page.

Hope this helps.


.
  • 0
Last edited by ampie g on 20 Jan 10 2:17 am, edited 1 time in total.
Reason: removed http as link is only used for illustration & not an actual link
 

sumo89
Posts: 2
Joined: 28 May 09
Trust:
Thanks for reply.
I probably should have used:
http://foo123.rspanish.hop.clickbank.net/
foo.com/recommends/rocketspanish/ (removed http)

Because the use of the word example was a little confusing in your reply. It's not clear if you you're referring to "the example" I posted OR you mean the domain called "example.com" directory called "example".

Doesn't a website have only one index.html file -> (e.g. website's home page?)

See: domain has a directory folder with index.html
recommends has a directory folder with index.html too,


1) index.html in the domain directory is the website's home page -> correct?
2) there's another index.html in the recommends directory? Does it have any have any code in it?



I thought the redirect code was saved in a index.php file, not an index.html file?


From what I can tell I should have this file structure:
public_html/domain/recommends/rocketspanish => where domain is foo.com

where foo's index.html is my website homepage. /recommends index.html is a blank file. and /rocketspanish has the index.php file in it. Is this correct? Why does recommends need an index.html file?
  • 0
Last edited by ampie g on 20 Jan 10 3:06 am, edited 1 time in total.
Reason: removed http as URL is only used for illustration & not an actual link
 

marcel66
Posts: 7
Joined: 26 May 09
Trust:
If you are using xSitePro like many here do, you can forget about all this and have your redirects created by xsitepro automatically (in HTML). One of the major advantages is not so much the ease of creation, but that you have all your redirects for certain projects and websites well organized in one centralized place. After creating a countless number of handcoded PHP redirects before, I just lost control and it became almost impossible to maintain this mess after some time.
  • 0
All The Best,
Marcel

-----
My Website for Webmasters and Affiliates:
http://www.Homepage-Building.com

Affiliates earn insane 70% Commissions with our Affiliate Program:
http://www.PDC-Products.com
----
 
PremiumMember
fthomas137
Posts: 61
Joined: 02 Jun 09
Trust:
Or, if you use the plugin for wordpress called 'go codes' your problems with dissappear too.
  • 0

This topic was started on May 29, 2009 and has been closed due to inactivity. If you want to discuss this topic further, please create a new forum topic.