You are here:  » Using Absolute URL As config_baseHREF

Support Forum



Using Absolute URL As config_baseHREF

Submitted by johnc on Fri, 2010-05-21 16:22 in

Hi David

If I specify an absolute URL as $config_baseHREF rather than just using a value of "/" will this cause any known problems?

As a preference I'd like to have absolute urls in the resultant HTML rather than relative ones.

I have identified one problem in that sitemap.php will generate incorrect URLS.

John

Submitted by support on Fri, 2010-05-21 16:55

Hi John,

You're correct - within the main script, it is no problem at all, if you want fully qualified (absolute) URLs then setting $config_baseHREF to that is fine, but in sitemap.php it is different, as it dynamically picks up the fully qualified URL from the $_SERVER["HTTP_HOST"] variable.

What I would do, is set $config_baseHREF to the fully qualified URL as required, and then in sitemap.php, override $_SERVER["HTTP_HOST"] to be an empty string. To do this, in sitemap.php, you'll find the following code on line 2:

  require("includes/common.php");

...REPLACE that with:

  require("includes/common.php");
  $_SERVER["HTTP_HOST"] = "";

Hope this helps!

Cheers,
David.