I have set up a CMSMS site that my end client now wishes to use https for. To that end they have now installed a secure certificate on the server.
When viewing the site using http, the site renders in the usual way. However, when using https the CSS stylesheet fails to load.
I have reviewed the rendered html and I can see that the stylesheet is being pulled in from "http://sitename...", even when using http in the link. If I change this using the browser inspector to "https://sitename.." the css is pulled in correctly and the pages render in the expected way.
I have reviewed the config.php file and everything appears to be set up correctly for this version of CMSMS. Additionally, I have tried setting pages to "Use HTTPS for this page:" in the options tab.
CMS version: 1.9.3 "Motu Tane"
The templates all use the {cms_stylesheet} tag to connect to the stylesheet in tmp/cache.
http site (renders correctly): http://windsorcreekapartments.com
https site (renders incorrectly): https://windsorcreekapartments.com
Any guidance greatly received.
Stylesheet not being pulled in when using https
-
- Forum Members
- Posts: 36
- Joined: Fri Mar 06, 2009 5:33 pm
Re: Stylesheet not being pulled in when using https
I'm sorry to inform you that version 1.9.3 isn't supported for a long time.
Modification have been made in the way https content is handled by CMSMS.
Seems the css is not your only problem by the way. Many (external) scripts are linked to http urls too.
Consider using protocol-relative urls for those.
You might want to try a dirty solution for your css to make it protocol-relative (untested):
{cms_stylesheet|regex_replace:'/https?:/':''}
Modification have been made in the way https content is handled by CMSMS.
Seems the css is not your only problem by the way. Many (external) scripts are linked to http urls too.
Consider using protocol-relative urls for those.
You might want to try a dirty solution for your css to make it protocol-relative (untested):
{cms_stylesheet|regex_replace:'/https?:/':''}
Last edited by velden on Mon Dec 19, 2016 3:31 pm, edited 1 time in total.
Reason: changed regex
Reason: changed regex
-
- Forum Members
- Posts: 36
- Joined: Fri Mar 06, 2009 5:33 pm
Re: Stylesheet not being pulled in when using https
Thanks for your response.
I will look at upgrading the CMS first.
I will look at upgrading the CMS first.