Forums

[Plugin: Google XML Sitemaps] relative URLs in loc fields (2 posts)

  1. masterleep
    Member
    Posted 2 years ago #

    Most of the loc fields in my sitemap are using relative URLs, for example:
    <loc>/blog/index.php/2006/12/19/all-hail-to-the-january-effect/</loc>

    According to the sitemap.org protocol, this is not allowed. "This URL must begin with the protocol (such as http)..."

    It looks like all of the post URLs are relative but the pages and misc links are absolute.

    http://wordpress.org/extend/plugins/google-sitemap-generator/

  2. masterleep
    Member
    Posted 2 years ago #

    I was able to work around it by modifying the plugin's sitemap-core.php file, changing the SetUrl function to:

    /**
    	 * Sets the URL of the page
    	 *
    	 * @param string $url The new URL
    	 */
    	function SetUrl($url) {
    		$temp_url=(string) $url;
    		if(substr($temp_url,0,7)!="http://") $temp_url="http://www.example.com" . $temp_url;
    		$this->_url=$temp_url;
    	}

Topic Closed

This topic has been closed to new replies.

About this Topic