Load CSS and JS over HTTPS or HTTP in PMWIKI

136 Views Asked by At

We have a website whose home page is http://bigbird.comp.nus.edu.sg/pmwiki/farm/appl/index.php As you see, it is based on pmwiki.

We find CSS, JS and other resources are loaded over http. That is because links generated by pmwiki's php files are prepended with http://. We want to remove the prepended http://. Links will become like:

<script src="//example.com/script.js"></script>

Which pmwiki's php files should we modify?

2

There are 2 best solutions below

0
user811416 On

Steve finds the right link. Just need to find all urls in /local/config.php and modify them as follows:

if ($_SERVER["HTTPS"] == 'on') {
  $FarmPubDirUrl = 'https://www.example.com/~someuser/pmwiki/pub';
} else {
  $FarmPubDirUrl = 'http://www.example.com/~someuser/pmwiki/pub';
}

No need to modify the http:// links in your webpages. I have not done further research. I guess the code means: if the page is requested via https, the related url become https links.

More detailed explanations are welcome.

1
Dfaure On

According to PmWiki.PathVariables and WikiFarms, the $FarmPubDirUrl and the related $FarmD variables are the ways PmWiki refers to static content.