Jump to content

Google Sitemap Issues since enabling SSL


Dirty Butter

Recommended Posts

I've been too busy to check on Webmaster Tools of late and only realized yesterday that for the last month Google was accepting our sitemap as valid, but was NOT indexing the products.

 

I suspected it was due to the https url's and used find/replace to change them back to http yesterday. Today's sitemap shows 3,220 pages indexed, as expected.

 

What can I do to get CC to create the sitemap with http, rather than https url's?

Link to comment
Share on other sites

The easiest change to make would be:

 

In the file /classes/seo.class.php, near line 835, starts the _sitemap_link() function.

Change:

$updated = (!$updated) ? time() : $updated;

to:

$updated = (!$updated) ? time() : $updated; $store_url = (CC_SSL) ? $GLOBALS['config']->get('config','standard_url') : $GLOBALS['storeURL'];

Six lines in, change:

$GLOBALS['storeURL']

to:

$store_url

 

This makes sure that, when SEO-mode is switched off, the "Standard URL" is used. (I'm not sure why 'config'.'standard_url' is not used as a matter of course.)

 

When the SEO-mode is switched on, SEO->generatePath() is used. The problem here is that generatePath() is used to create all seo-friendly URLs at all times -- under SSL and otherwise. $GLOBALS['storeURL'] will be http or https according to other criteria.

 

To deal with this, we will need to get a bit messy. In _sitemap_link(), change:

$input['url'] = $this->generatePath($input['id'], $type, '', true, true);

to:

$input['url'] = $this->generatePath($input['id'], $type, '', $store_url, true);

 

We are hijacking one of the parameters that says to use the store domain address or to not use it when returning a URL.

 

In the generatePath() function, near the end, change:

return (($absolute) ? $GLOBALS['storeURL'] . '/' . $safe_path : $safe_path) . (($extension) ? $this->_extension : '');

to:

return (($absolute) ? ( (is_string($absolute)) ? $absolute : $GLOBALS['storeURL'] ) . '/' . $safe_path : $safe_path) . (($extension) ? $this->_extension : '');

 

What we have done is to further the testing of $absolute so that if $absolute is actually a string (not just simply something that looks true), then we will use the string. Otherwise we will use the global store URL, whatever it is, as discussed above.

Link to comment
Share on other sites

Perhaps related, I had to hard code the logo url in our email template to get the logo to show up in Outlook after the SSL change. It worked properly with the logo string previously, but when I activated the SSL the logo had an https url. For some reason Outlook would not show it. By hard coding the http version of the logo, all works perfectly again.

 

Doing the find/replace in the sitemap has been more of an issue than I had imagined. I'm in the process of testing an upgrade to our skin, with cache disabled. But to flip back and forth between current version and new version, as I test, I need to rebuild the sitemap, as there are new pages with the new version. Last night Google "caught me" in the midst of testing and sure enough, this morning only 4 items were indexed - thanks to the https.

 

SO - do I use Bsmither's suggestion or Al's????????

Link to comment
Share on other sites

 

Maybe a dirty fix in between is a string replacement of https:// to http:// prior to file write.

 

Which, of course, I haven't a clue how to do on my on. LOL

 

Well, what do you know - I think I did it! I Googled how to code a string replace and played with it until I found what seems to be the right code and placement.

 

In seo.class.php at the end of the create sitemap section:

		$sitemap = $this->_sitemap_xml->getDocument(true);
//MY ADDITION TO CHANGE HTTPS TO HTTP IN SITEMAP
$sitemap=str_replace("https:","http:",$sitemap);

Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...