Free Web Hosting Forum
Go Back   Free Web Hosting Forum > Website Building > Web Design and HTML
Reload this Page Robots.txt and Analytics Code
Reply
 
Thread Tools Display Modes
(#1 (permalink))
Old
Junior Member
costyn1 is on a distinguished road
 
Posts: 17
Join Date: Jun 2009
Default Robots.txt and Analytics Code - 10-31-2009, 09:57 PM

I have a problem using robots.txt.
I want to hide /referrer/ , it should not be in the search engines.
So I wrote this robots.txt file:

User-agent: *
Disallow: /referrer/
Allow: /

The problem is that Google reads the following lines:


User-agent: *
Disallow: /referrer/
Allow: /


<!-- www.000webhost.com Analytics Code -->
<script type="text/javascript" src="http://analytics.hosting24.com/count.php"></script>
<noscript><a href="http://www.hosting24.com/"><img src="http://analytics.hosting24.com/count.php" alt="web hosting" /></a></noscript>
<!-- End Of Analytics Code -->

So Google "thinks" the file is not valid.
I removed the "Analytics Code" using the CPANEL, infact the code doesn't appear in any of my html pages.
Why does it appears when Google reads the robots.txt files?
This is a really really big problem.
Sites with a bad robots.txt file could be banned from search engines.
Could you help me?
Reply With Quote
Sponsored Links
(#2 (permalink))
Old
Member
lark is on a distinguished road
 
Posts: 31
Join Date: May 2009
Default 10-31-2009, 11:17 PM

go to http://members.000webhost.com/analytics.php to turn off analytic code.
Reply With Quote
(#3 (permalink))
Old
Junior Member
costyn1 is on a distinguished road
 
Posts: 17
Join Date: Jun 2009
Default No luck - 11-01-2009, 10:55 AM

I tried but the problem is still present.
Reply With Quote
(#4 (permalink))
Old
Member
lark is on a distinguished road
 
Posts: 31
Join Date: May 2009
Default 11-04-2009, 07:40 AM

refresh the page to make sure you are looking at a non-cached version.

Also I'm not sure whether the CP has an option for analytic code, but just search through there in case.

gl.
Reply With Quote
(#5 (permalink))
Old
sizzlefire's Avatar
Administrator
sizzlefire is on a distinguished road
 
Posts: 4,531
Join Date: Apr 2008
Send a message via AIM to sizzlefire Send a message via MSN to sizzlefire Send a message via Yahoo to sizzlefire Send a message via Skype™ to sizzlefire
Default 11-04-2009, 08:50 PM

What is your website?
Reply With Quote
(#6 (permalink))
Old
Junior Member
Araneda is on a distinguished road
 
Posts: 5
Join Date: Nov 2009
Default 11-05-2009, 01:30 PM

The code is not disabled if Google crawls robots.txt.
Perhaps the only solution is to redirect "robots.txt" to a script.
Reply With Quote
(#7 (permalink))
Old
Member
lark is on a distinguished road
 
Posts: 31
Join Date: May 2009
Default 11-07-2009, 06:05 AM

I had a similar problem, does your robots.txt file display like the following:

User-agent: * Disallow: /referrer/ Allow: /

instead of:

User-agent: *
Disallow: /referrer/
Allow: /

If so check the robots.txt content type. (if you are using mozilla firefox right click and choose 'View page info' and the type of the file should be next to 'Type:'

My file was being read as text/html which doesn't work. It should be read as text/plain

Here's what I did to fix it..

If you do not already have a .htaccess file, make one in the public_html folder. (The same folder that your main index file goes into.)
And the file is named ".htaccess" there is nothing before the dot.

Inside that file add these lines..

.htaccess file:
Code:
<FilesMatch "robots.txt">
 SetHandler application/x-httpd-php
</FilesMatch>
This will make your robots.txt file be read by the php parser.

Now inside your robots.txt file add the following..

PHP Code:
<?php
header
("Content-type: text/plain");
?>
(robots.txt file goes underneath this. eg)
User-agent: *
Disallow: /referrer/
Allow: /
Hope this helped.


edit: Just did this for a new site I set up. The above is necessary for it to be read as text and interpreted as a robots.txt file but not sure if robots.txt will still work if the analytic code is still below it.
All I can say is that I went to members.000webhost.com/analytics.php and followed the instructions.

Make sure you type in your site's address without http:// or www.
For example: mysite.site11.net <-- that is all you should put in, obviously replacing it for your sites address..

Make sure the drop down option is on 'Disable analytics code', NOT enable.

And obviously make sure that your password is correct.

Maybe post your site's address here so others can have a look.
And if nothing here works, submit a support ticket.

Last edited by lark; 11-07-2009 at 10:12 AM.
Reply With Quote
(#8 (permalink))
Old
Junior Member
Araneda is on a distinguished road
 
Posts: 5
Join Date: Nov 2009
Default 11-09-2009, 01:56 PM

The problem is the content type. The same applies to the XML file.
Add the following line in the .htaccess file:

AddType text/plain .txt
Reply With Quote
(#9 (permalink))
Old
KnK KnK is offline
Senior Member
KnK is on a distinguished road
 
Posts: 199
Join Date: Sep 2009
Location: Spain, but orriginally from Reading UK
Default 11-10-2009, 03:17 AM

once you have disabled analytic code add thi to your .htaccess file

Code:
php_value auto_append_file none
php_value auto_prepend_file none
Reply With Quote
(#10 (permalink))
Old
Junior Member
Araneda is on a distinguished road
 
Posts: 5
Join Date: Nov 2009
Default 11-11-2009, 12:42 PM

In the case of the robots.txt file simply add the correct MIME type:

AddType text/plain .txt

Anyway, KnK is right. Running phpinfo() script you'll see:

auto_append_file /usr/lib/php/foot.php
auto_globals_jit On
auto_prepend_file /usr/lib/php/head.php

So, to disable the code injection in scripts you need to add the php_value directive
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.5.2
vBulletin Skin developed by: vBStyles.com