Can you put meta tags in a php file

Discussion in 'PHP' started by fadetoblack22, Dec 26, 2008.

  1. #1
    I have the following code in a file called links.php for my external links:

    <?php
    $path = array(
    'google' => 'http://www.google.com',
    'dp'=> 'http://forums.digitalpoint.com');
    if (array_key_exists($_GET['id'], $path)) header('Location: ' . $path[$_GET['id']]);
    ?>
    Code (markup):
    e.g. <a href="mysite.com/links.php?id=google">google</a> for google


    I want to add noindex meta tags to links.php

    Is this possible?

    thanks.
     
    fadetoblack22, Dec 26, 2008 IP
  2. tamen

    tamen Peon

    Messages:
    182
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    No. It wouldn't be shown because the browser is redirected before the metatags are send.
     
    tamen, Dec 26, 2008 IP
  3. tamen

    tamen Peon

    Messages:
    182
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    You could set the noindex on links.php in a robots.txt-file though.
     
    tamen, Dec 26, 2008 IP
  4. fadetoblack22

    fadetoblack22 Well-Known Member

    Messages:
    2,399
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    160
    #4
    thanks. would that work for nofollow as well?
     
    fadetoblack22, Dec 26, 2008 IP
  5. tamen

    tamen Peon

    Messages:
    182
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Maybe. I think nofollow pertains to links. You are setting a redirect in links.php
    You can dissallow links.php in robots.txt though. That should keep robots away from links.php.
     
    tamen, Dec 26, 2008 IP
  6. fadetoblack22

    fadetoblack22 Well-Known Member

    Messages:
    2,399
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    160
    #6
    thanks for the help :)
     
    fadetoblack22, Dec 26, 2008 IP