user811416
user811416

Reputation: 205

Load CSS and JS over HTTPS or HTTP in PMWIKI

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?

Upvotes: 1

Views: 140

Answers (2)

Dfaure
Dfaure

Reputation: 584

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

Upvotes: 0

user811416
user811416

Reputation: 205

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.

Upvotes: 1

Related Questions