google-sitemaps-problems with EE - standard-solution?
Posted: 01 April 2007 07:54 AM   [ Ignore ]  
Lab Assistant
Avatar
RankRank
Total Posts:  241
Joined  05-11-2004

hi,

i still have problems to verify my sitemap, as described here (post 21).

This page contains the following errors:

error on line 1 at column 1: Extra content at the end of the document
Below is a rendering of the page up to the first error
.

when i search the forums i have the impression, that the wiki-entry “Sitemaps” doesn’t work for a lot of people here. (btw: that on this wiki-page there is no “last-change”-date makes the thing uncomfortable).

so i want to ask: is there anywhere a simple description with actual code-snippets, how i can make google-sitemaps work for a quite average EE-installation?!

thx in advance

 Signature 

Der Lehrerfreund
Der Spamschlucker
Der Schweinische Bote

Profile
 
 
Posted: 01 April 2007 07:58 AM   [ Ignore ]   [ # 1 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  23751
Joined  05-20-2002

I think it just varies a bit depending on your server config.  I did mine based on the wiki, and while I tweaked it to suite my needs, it was pretty straightforward.  But I suspect that may be somewhat host dependent.

Can you link to the actual sitemap- I’d like to see what’s being output.

 Signature 

AKA rob1

Help Request TipsPro Network

Profile
 
 
Posted: 01 April 2007 08:02 AM   [ Ignore ]   [ # 2 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  241
Joined  05-11-2004

the file /sitemap.php is here: http://www.lehrerfreund.de/sitemap.php

code:

<?php

// Prevent content to be cached
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Content was generated on past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); //Content is always modified

// Inform user agent that content is XML and is UTF-8 encoded
header('Content-type: text/xml; charset=UTF-8');

// Read content from template and show it
@readfile ('http://www.lehrerfreund.de/in/schule/google-sitemap/')
?>

 Signature 

Der Lehrerfreund
Der Spamschlucker
Der Schweinische Bote

Profile
 
 
Posted: 01 April 2007 08:21 AM   [ Ignore ]   [ # 3 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  23751
Joined  05-20-2002

The included file looks good- who’s your host?

 Signature 

AKA rob1

Help Request TipsPro Network

Profile
 
 
Posted: 01 April 2007 08:24 AM   [ Ignore ]   [ # 4 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  241
Joined  05-11-2004

i have a server @ SpaceNet, a german, good hoster. is there anything i could ask them for?

so the error occurred on an “old” = other server also ...

 Signature 

Der Lehrerfreund
Der Spamschlucker
Der Schweinische Bote

Profile
 
 
Posted: 01 April 2007 08:37 AM   [ Ignore ]   [ # 5 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  23751
Joined  05-20-2002

Hm- I’m wondering if they allow readfile.  I’m not sure this will work- but let’s see if we can get an error.  So in your php file- change it to:

readfile('http://www.lehrerfreund.de/in/schule/google-sitemap/');


Note the semicolon as well.

 Signature 

AKA rob1

Help Request TipsPro Network

Profile
 
 
Posted: 01 April 2007 08:45 AM   [ Ignore ]   [ # 6 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  241
Joined  05-11-2004

now i get a slightly different error:

This page contains the following errors:

error on line 2 at column 1: Extra content at the end of the document
Below is a rendering of the page up to the first error
.

 Signature 

Der Lehrerfreund
Der Spamschlucker
Der Schweinische Bote

Profile
 
 
Posted: 01 April 2007 09:03 AM   [ Ignore ]   [ # 7 ]  
Administrator
Avatar
RankRankRankRankRankRank
Total Posts:  6762
Joined  03-23-2006

Looks like readfile isn’t supported by your host (a number of hosts disable this, as they consider it a security concern).

There are workaround instructions for this in the wiki entry on Google sitemaps.  Look down near the bottom for the code underneath “For you fine folks on Dreamhost.com, since they don’t allow @readfile you may want to try this: “

After you try that, make sure that there are no extra spaces or returns before the opening “<?php” or after the closing “?>”

 Signature 

DerekAllard.com - CodeIgniter, ExpressionEngine, and the World of Web Design
BambooInvoice - Open Source, CodeIgniter powered invoicing.

Profile
MSG
 
 
Posted: 01 April 2007 09:06 AM   [ Ignore ]   [ # 8 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  23751
Joined  05-20-2002

It’s throwing php errors- if you do a reveal code you’ll spot:

URL file-access is disabled in the server configuration in sitemap.php on line 11

In other words- the server is one of those that won’t let you use readfile.  I haven’t had try to work around that- but on the wiki link, they suggest using curl if it’s available.  So- I’d give that a try:

<?php
// Prevent content to be cached
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Content was generated on past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); //Content is always modified

// Inform user agent that content is XML and is UTF-8 encoded
header('Content-type: text/xml; charset=UTF-8');

// Read content from template and show it
$curl_handle=curl_init();
curl_setopt($curl_handle,CURLOPT_URL,'http://www.lehrerfreund.de/in/schule/google-sitemap/');
curl_exec($curl_handle);
curl_close($curl_handle);
?>


Make sense what’s going on with this?

 Signature 

AKA rob1

Help Request TipsPro Network

Profile
 
 
Posted: 01 April 2007 09:10 AM   [ Ignore ]   [ # 9 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  241
Joined  05-11-2004

YES! this did it (but i had to add a semicolon in the line

curl_exec($curl_handle);

thanks a lot!

 Signature 

Der Lehrerfreund
Der Spamschlucker
Der Schweinische Bote

Profile
 
 
Posted: 01 April 2007 09:16 AM   [ Ignore ]   [ # 10 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  23751
Joined  05-20-2002

Sweet!  Glad you got it figured out- and thanks for the tweak- I’ll edit my code in case anyone else copy/pastes!

 Signature 

AKA rob1

Help Request TipsPro Network

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 66475 Total Logged-in Users: 38
Total Topics: 84881 Total Anonymous Users: 21
Total Replies: 455407 Total Guests: 226
Total Posts: 540288    
Members ( View Memberlist )