Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

redirect script with noindex, nofollow, noarchive

Proper way to accomplish this?

9:39 pm on Sep 6, 2012 (gmt 0)

Preferred Member

10+ Year Member

joined:May 21, 2004
posts: 385
votes: 5

Looking to use a php redirect script for my site and I do not want the page to be indexed, followed, archived, etc.

I have disallowed the /goto.php page in my robots.txt, however, Google also states if other sites link to this page it could still be picked up.

To entirely prevent a page's contents from being listed in the Google web index even if other sites link to it, use a noindex meta tag or x-robots-tag. As long as Googlebot fetches the page, it will see the noindex meta tag and prevent that page from showing up in the web index. The x-robots-tag HTTP header is particularly useful if you wish to limit indexing of non-HTML files like graphics or other kinds of documents.

So, is my implementation of the x-robots-tag below correct and will this accomplish what I am looking for?

Use the following link format:
<a href="/goto.php?p=XXXXXX">XXXXXX</a>

$p = $_GET['p'];

switch ($p)

case "widget1":
$link = "/widget1.htm";

$link = "/default.htm";

header("X-Robots-Tag: noindex, nofollow, noarchive", true);
header("Location: $link");

9:48 pm on Sept 6, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
votes: 0

Use the Live HTTP Headers extension for Firefox to see the actual header your server returns.

You'll also see your redirect is a 302 redirect.

Rather than case statements, the code can be easier to maintain if you use an array for the URL pairs.
10:05 pm on Sept 6, 2012 (gmt 0)

Preferred Member

10+ Year Member

joined:May 21, 2004
posts: 385
votes: 5

Thanks g1smd,

Already did that and looks fine :

HTTP/1.1 302 Found
X-Robots-Tag: noindex, nofollow, noarchive
Location: http://www.widgets.com

minus all the other headers.

I guess I was asking more if this would be the preferred method so Google is not indexing the link or passing anything on? This seems a much better method to me than manually adding a rel=nofollow all over the site and makes managing the links much easier.

Would using a 301 perm be better for any reason?

I didn't think about using an array as this was the first thing to pop in my head, but yeah, it would clean it up a bit.