You are here:  » Sitemaps using http: on https: site


Sitemaps using http: on https: site

Submitted by 2fer on Wed, 2016-05-11 07:25 in

Hi David,
Is there something I need to edit so that my shop "knows" it is on https:? You can't visit the URLs it generates in the sitemaps, everything is 301 redirected to https: but the URLs in the sitemaps are http:

If I copy a URL from a sitemap and paste it into my browser's address bar, The headers show
HTTP/1.1 301 Moved Permanently
so the URLs I'm submitting can't be visited. Any ideas? The base href is /shop/ and the shop was installed before the SSL so it still shows host as http: but I have htaccess 301 rewrites in the root and in /shop/

I'm still on the old 13a. Any suggestions appreciated, thanks!
2fer

Submitted by support on Wed, 2016-05-11 08:29

Hello 2fer,

In sitemap.php look for the following code at line 22:

    $sitemapBaseHREF = "http://".$_SERVER["HTTP_HOST"];

...and REPLACE with:

    $sitemapBaseHREF = "http".(isset($_SERVER["HTTPS"])&&$_SERVER["HTTPS"]?"s":"")."://".$_SERVER["HTTP_HOST"];

And then the following code at line 65:

      $sitemapBaseHREF = "http://".$_SERVER["HTTP_HOST"];

...and REPLACE with:

      $sitemapBaseHREF = "http".(isset($_SERVER["HTTPS"])&&$_SERVER["HTTPS"]?"s":"")."://".$_SERVER["HTTP_HOST"];

And finally the following code at line 88:

    $sitemapBaseHREF = "http://".$_SERVER["HTTP_HOST"].$config_baseHREF;

...and REPLACE with:

    $sitemapBaseHREF = "http".(isset($_SERVER["HTTPS"])&&$_SERVER["HTTPS"]?"s":"")."://".$_SERVER["HTTP_HOST"].$config_baseHREF;

I'll include this in the next distribution.

Cheers,
David.
--
PriceTapestry.com

Submitted by 2fer on Wed, 2016-05-11 15:10

Hi David,
Thank you so much for the fast fix! I was using a multi-file search to pick out the line and it turned up the same line as you show at line 88 in my category sitemap file so I replaced that one as well. My sitemap.php file had the date of 05/30/13 and the second line was at line 47, not 88 in case that makes any difference.

This has been most puzzling to me because for a long time I've needed to have the old http: site listed at GSC (old GWT) in order to have any sitemap there at all. The sitemap URLs show as https: but were not showing up under the https: "property" in GSC. This should make the difference. I appreciate you great support, as always!
Thank you,
2fer