[Solved] Google XML Sitemap Stylesheet Error

If you’re using google xml sitemap wordpress plugin,Β  you will notice an error message as below when you’re accessing your sitemap
For example: http://domain.com/sitemap.xml
Error loading stylesheet: An unknown error has occurred (805303f4)
There is no problem with accessing your sitemap by adding http://www.domain.com/sitemap.xml
How to remove www infront of Google sitemap xml
Method A
Just Add The Following code To Your .htaccess
[code]
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain.com [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]
[/code]
Note:
1. Replace domain.com With Your Domain Name
2. Use If Your WordPress site Is Without www Means then Just Use The Following the reverse Order )
[code]
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.domain.com [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [L,R=301]
[/code]
Method B
I’m using Method B because is seem like the correct way to solve this error message.
Go to your Sitemap-core.php file located in your cpanel
/wp-content/plugins/google-sitemap-generator/sitemap-core.php
[code]
function GetDefaultStyle() {
$p = $this->GetPluginPath();
if(file_exists($p . "sitemap.xsl")) {
$url = $this->GetPluginUrl();
//If called over the admin area using HTTPS, the stylesheet would also be https url, even if the blog frontend is not.
if(substr(get_bloginfo(‘url’),0,5) !="https" && substr($url,0,5)=="https") $url="http" . substr($url,5);
return $url . ‘sitemap.xsl’;
}
return ”;
}
[/code]
Remove the above code and add below code
[code]
function GetDefaultStyle() {
$p = $this->GetPluginPath();
if(file_exists($p . "sitemap.xsl")) {
return ‘/wp-content/plugins/google-sitemap-generator/sitemap.xsl’;
}
return ”;
}
[/code]
Finally rebuild your sitemap manually in your wordpress dashboard settings
Interested to build website, kindly visit Web Design Malaysia
 

45 thoughts on “[Solved] Google XML Sitemap Stylesheet Error

  1. Looked like it should have worked, but I got the following error after I updated the file (using your Method B) and attempted to access Sitemap XML from WordPress admin:
    Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ‘,’ or ‘;’ in /home/yeolde/public_html/wp-content/plugins/google-sitemap-generator/sitemap-core.php on line 2377
    Any ideas?
    M

  2. superb, i followed steps present in method B, it worked nicely, thanks lot i was thinking how to solve this issue, thanks for your wonderful help. i tired in mozilla, chrome it works flawlessly :). tons of thanks

  3. Awesome…couldn’t get method B to work right, but method A worked like a charm. Google wasn’t able to index the sitemap correctly – Method A fixed it for me. Well done.

  4. Hi,
    Thanks so much for sharing the information, your Method B worked like a charm without having to alter the sitemap-core.php

Leave a Reply

Your email address will not be published. Required fields are marked *