Forum Moderators: goodroi

Message Too Old, No Replies

PHP includes with robots.txt

will this work?

         

ionchannels

10:26 am on Apr 19, 2006 (gmt 0)

10+ Year Member



Would it be possible to use php to include an external robots.txt so that I can update it once and it will work for all my sites? I will put .txt files into the httpd.conf file...

encyclo

4:17 pm on Apr 19, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



As long as you ensure that the output is a valid robots.txt file and it is served with the mime type
text/plain
(you must set it specifically with an HTTP header as PHP outputs
text/html
by default) then you'll be fine - the spider will only see the output not the underlying code.

I have been using PHP-generated (cloaked) robots.txt files for a while with no ill-effects.

ionchannels

11:45 pm on Apr 20, 2006 (gmt 0)

10+ Year Member



Thanks, I didn't know about the header information. That will help a great deal. Cheers...