You are here:  » Need to rerun setup to change "Base HREF"?


Need to rerun setup to change "Base HREF"?

Submitted by 2fer on Sun, 2018-11-18 18:16 in

Greetings Dvaid,
Me again, another host change again. (Still on 13A) I'm using AutoSSL and everything looks great except that the shops' internal files think they are at http still. I used search/replace to remove all http: from any URLs which leaves the protocol-agnostic "//" in place of http: - works fine. The shop URLs show https, no problem but inside the tools like the Automation Tool to set up CRONs it shows http:

Where it lists software, it shows the http: version as the Base HREF as in:
{code saved}

Related side question: I have searched for the answer to that question and ran across a different question about the sitemap using http: URLs. I now have three versions of the sitemap.php and downloading PT v16a to use its sitemap will make it 4. I noticed in that answer that it suggested editing this line:
src='<?php print $config_baseHREF."...
to use
src='https://www.example.com<?php print $config_baseHREF."..
for that problem. Can I edit my (+categories+404) sitemap.php this way - or will I need to use a newer 16a version?

The shop has been around for over 5 years, do I need to re-run setup.php to change the baseHREF? I sure don't want to need to do that (there are several more shops to deal with) but the information stored is not editable via admin.

PT is such an adaptable resource, I just know you have a way to fix this. Please?
Thanks again!
2fer

Submitted by support on Mon, 2018-11-19 08:35

Hi,

For $config_baseHREF, unless you have a specific need to use the fully qualified URL I would just use the path as normal, e.g.

$config_baseHREF = "/shop/";

To change your modified sitemap.php for https, check for any lines setting $sitemapBaseHREF

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

..and REPLACE with:

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

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by 2fer on Tue, 2018-11-20 04:11

Thank you David,
I will use this method because I prefer to use your expertise than my trial and error guessing methods. I apologize for the confusion, I did not mean I wanted to change the BaseHREF as shown in the configuration files. I have a /shop/ folder rewrite in place so that the pages and results are all pretty green padlocks. I see I was not very clear on that. I just copied/pasted the line from my notes.

I got ahead of myself and searched all my Price Tapestry folders for 'http:' and found two lines in the sitemap.php file script, one line in the categories.sitemap.php file script and one in the admin/support.php file, and just changed them all to https: and ran my test on a test site and it did produce https: sitemaps. I did not have any problem, and it did also correct the place in the support tab, where it now shows https: for the cron ftp option. I am not a php adventurer but because I do temporarily have a secure test site, I tried it there.

That produced a new question. The sitemap.php file shows this at line 52:
print "<sitemapindex xmlns='http://www.sitemaps.org/schemas/sitemap/0.9'>";

I idly wondered whether that should be https: as well, so I visited the URL and it does redirect to 'https:', so - would that make any earthly difference if I changed that to https: in the sitemap.php file?

Thank you again for all your help.
2fer

Submitted by support on Tue, 2018-11-20 08:35

Hi,

Although it's understandable that the "URL" used as the xmlns (namespace) redirects to https, it is in fact only a namespace - it's not anything that is actually requested as part of the sitemap handling process; and since it remains as http:// in the sitemaps.org 0.9 specification I would leave that has http for the time being...

Cheers,
David.
--
PriceTapestry.com

Submitted by 2fer on Wed, 2018-11-21 16:12

Hi David,
Thank you, that explains it clearly. As always, I am most grateful for your help and patience with these details. Your customer service is incomparable!

You're the best!
2fer