What does a proper redirect html file look like?

danniee

Affiliate Guard Dog Member
Joined
Feb 5, 2018
Messages
538
Reaction score
317
This is currently what my redirect html files look like:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 FRAMESET//EN">
<HTML>
<HEAD>
<meta http-equiv="refresh" content="0; url=https:// casino.tracking-affiliates.com/redirect.aspx?pid=123456&bid=1234" />
</HEAD>
</HTML>
But I suspect I should also have a nofollow in there somewhere as I'm getting tons of duplicate pages warnings in Ahrefs and whatnot. Any suggestions on how to make a proper redirect html file?
 
Last edited:

AussieDave

24 years & still going!
Joined
Nov 28, 2013
Messages
4,991
Reaction score
3,532
@danniee - This is a very, very old school practice, one which will likely irate Google. (G specifically states not to use this method).

Can either use htaccess (but unless your on a VPS or own dedi server, some hosts don't allow you access to htaccess).

Hence, a better, one size fits all solution, a php redirect file. I use the php version.

Setup a folder on your root (EG: goto).
Inside that folder, you add the following code to every file you want to redirect. In the case of your example aff code:

Code:
<?php
$url = /*starturl*/"https://casino.tracking-affiliates.com/redirect.aspx?pid=123456&bid=1234"/*endurl*/;
header("Location: ".$url);
?>

I always name that file, the name of the casino it's being redirected to: EG - xyzcasino.php

To implement the redirect on a banner/link you'd add the following (using the example folder and file name):

Code:
<a href="https://yourdomain.com/goto/xyzcasino.php">visit casino XYZ</a>

If your domain is www. then you'd change the above to:
Code:
<a href="https://www.yourdomain.com/goto/xyzcasino.php">visit casino XYZ</a>

EDIT:

NB - You need to make a separate php file for each affiliate program redirect, and save each of those files to the root folder (EG - goto). You also need to change the above link/banner code to each redirected php file name.
 
Last edited:

danniee

Affiliate Guard Dog Member
Joined
Feb 5, 2018
Messages
538
Reaction score
317
Hi AussieDave!

Boy am I glad I asked. I created all my cloaks back when I started out and never really bothered to have a look at it until now.

So I just upload it to my folder as index.php, right? And it will work pretty much as my index.html did? No need to add a nofollow anywhere or something like that?

I really appreciate your kind help, it's super sweet of you :)
 

TheGooner

Affiliate Guard Dog Member
Joined
Dec 31, 2013
Messages
607
Reaction score
570
Intersting ... I have used and still do use the OP's method in the past for client redirects (to programs).

This is the format I use for internal redirects :
<?php
// Permanent redirection
header("HTTP/1.1 301 Moved Permanently");
header("Location: https://www.goonersguide.com/");
exit();
?>

so (for whatever mad reason) I use both systems for different reasons.
I have no idea why.
;-)
 

AussieDave

24 years & still going!
Joined
Nov 28, 2013
Messages
4,991
Reaction score
3,532
So I just upload it to my folder as index.php, right?

NO...

  1. Create a new folder (EG - goto) on your root (your site's root, normally resides in your public_html folder)
  2. In the goto folder, you add a separate php file for each of your casino trackers.
EG: 123Casino = 123casino.php, xyzcasino = xyzcasino.php

Hence, in your goto folder, you'd have 2 php files.

Each tracker is assigned a separate php file, which is saved to the folder goto.

Edit:
Forget the index file... Follow my examples above, don't deviate from those examples and this will work for you.
 
Last edited:

AussieDave

24 years & still going!
Joined
Nov 28, 2013
Messages
4,991
Reaction score
3,532
This is the format I use for internal redirects :
Code:
<?php
// Permanent redirection
header("HTTP/1.1 301 Moved Permanently");
header("Location: https://www.goonersguide.com/");
exit();
?>

so (for whatever mad reason) I use both systems for different reasons.
I have no idea why.
;-)

I used the following htaccess to redirect:

Code:
Redirect 301 /oldfile.php https://mydomain.com/newfile.php

# folder 301 redirect

Redirect 301 /oldfolder/ https://mydomain.com/newfolder/

# file within folder redirect

Redirect 301 /oldfolder/oldfile.php https://mydomain.com/newfolder/newfile.php

I find using htaccess a lot easier to keep track of, and it uses less bytes ;)

If one doesn't have direct access to htaccess code...

cPanel has a module to add 301 redirects, which write them to the root's htaccess file.
 

danniee

Affiliate Guard Dog Member
Joined
Feb 5, 2018
Messages
538
Reaction score
317
NO...

  1. Create a new folder (EG - goto) on your root (your site's root, normally resides in your public_html folder)
  2. In the goto folder, you add a separate php file for each of your casino trackers.
EG: 123Casino = 123casino.php, xyzcasino = xyzcasino.php

Hence, in your goto folder, you'd have 2 php files.

Each tracker is assigned a separate php file, which is saved to the folder goto.

Edit:
Forget the index file... Follow my examples above, don't deviate from those examples and this will work for you.

Ah, ok I see what you mean. The problem is though (in my case) that I have my affiliate links all over the place so I have to maintain my url? All my links now look like this:

mysite.com/go/leovegas (the leovegas folder includes the index.html file as do all other)

I tried your example:

mysite/go/leovegas (leovegas.php)

...but that breaks the old url's. However, doing it like...

mysite.com/go/leovegas (index.php)

...works for me and all url's are maintained.

Is it completely wrong doing it that way or would it be ok in my case? Obviously your suggestion is better as it saves the extra subfolders, but I should still be ok, or?

Thanks again AussieDave, very kind of you to help out.
 

NDG

Affiliate Guard Dog Member
Joined
Sep 19, 2013
Messages
654
Reaction score
461
We've been using this for many years without any issues.

Code:
<html>
  <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name=“robots” content=“noindex,nofollow”>
  </head>
  <body onload="document.location='AFFILIATE URL HERE';">
  </body>
</html>

This is an index file in a separate folder for each casino.

I think it looks better when the URL goes to a folder and does not display the .php extension of the file.
 

danniee

Affiliate Guard Dog Member
Joined
Feb 5, 2018
Messages
538
Reaction score
317
We've been using this for many years without any issues.

Code:
<html>
  <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name=“robots” content=“noindex,nofollow”>
  </head>
  <body onload="document.location='AFFILIATE URL HERE';">
  </body>
</html>

This is an index file in a separate folder for each casino.

I think it looks better when the URL goes to a folder and does not display the .php extension of the file.

Not sure what you mean. When I tried AussieDave's approach it did not show any .php extension for me?
 

AussieDave

24 years & still going!
Joined
Nov 28, 2013
Messages
4,991
Reaction score
3,532
doing it like...

mysite.com/go/leovegas (index.php)

...works for me and all url's are maintained.

You didn't tell me you were using: /go/casinoname/index.html for each casino redirect. If I knew that, well nvm...

If that works for you, that's fine. Just name each file index.php

Or use NDG's version, either is OK.
 
Last edited:

danniee

Affiliate Guard Dog Member
Joined
Feb 5, 2018
Messages
538
Reaction score
317
You didn't tell me you were using: /go/casinoname/index.html for each casino redirect. If I knew that, well nvm...

If that works for you, that's fine. Just name each file index.php

Or use NDG's version, either is OK.

Thank you again best sir :)
 

TheGooner

Affiliate Guard Dog Member
Joined
Dec 31, 2013
Messages
607
Reaction score
570
I used the following htaccess to redirect:
I find using htaccess a lot easier to keep track of, and it uses less bytes ;)

Nah. I'd end up with hundreds of lines in my htaccess.

I use them to redirect old program reviews (desktop and mobile), goto links, etc ... so there are usually 4-5 per program and I've probably tested and dumped 200+ programs in my time - so I might have 1000+ of these files on site now - as I prefer to overwrite the old content rather than let it sit.
 
Top