1

I have a (randomly named) php file that does a bit of processing and then uses a header("location:url") to redirect to another page.

As mentioned, the script has a random name (eg: euu238843a.php) for security reasons as I don't want people stumbling upon it.

Thing is - How do I stop Google from indexing it - I want other pages in the same directory to be indexed but not this php file. I don't want people to be able to do a site:myurl.com and find the "hidden" script.

I would normally put a meta name="robots" content="noindex" in the head but, I can't do that as the page needs to ouput headers at the end to redirect.

Chris Jones
  • 405
  • 1
  • 6
  • 17

1 Answers1

0

You can dynamically updated the robots.txt file within the directory using a PHP script that outputs a new or appended robots.txt as needed. If you specify each dynamic filename on a new line, such as Disallow: /File_12345.html, you can avoid having to disallow the entire directory.

Bryan Potts
  • 901
  • 1
  • 7
  • 20
  • Thanks for the answer - That would work but my only concern is that anyone with a bit of knowledge would be able to read robots.txt and then instantly see the names of the files I don't want them to find. – Chris Jones Apr 22 '13 at 21:20