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

RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain.com [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]

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 )

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.domain.com [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [L,R=301]

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

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 '';
        }

Remove the above code and add below code

function GetDefaultStyle() {
                $p = $this->GetPluginPath();
                if(file_exists($p . "sitemap.xsl")) {
                        return '/wp-content/plugins/google-sitemap-generator/sitemap.xsl';
                }
                return '';
        }

Finally rebuild your sitemap manually in your wordpress dashboard settings