Page 1 of 1

SSL and relative urls

Posted: Wed Dec 31, 2014 8:20 am
by peterasap
Hello,

We are about to move our site on SSL and I was wondering if there is guide I can read with helpful tips or something ?

The problem I am facing at the moment is that most of the urls are absolute i.e

Code: Select all

<a href='http://www.example.com/somelink.html'>Link</a>
while I want it to be:

Code: Select all

<a href='/somelink.html'>Link</a>
For menus I found this:

http://forum.cmsmadesimple.org/viewtopi ... =8&t=15441

However for News module I have found nothing ?

Any hint, ideas and general directions on using relative urls will be appreciated.

Thanks,

Peter

Re: SSL and relative urls

Posted: Wed Dec 31, 2014 10:54 am
by velden
I don't think the urls need to be relative as cmsms will dynamically create those absolute urls depending on the current url and protocol used.

Read the pdf about config.php that comes in the /docs folder of the cmsms install. There are some config settings to enable SSL for frontend as well as backend (admin). Personally I don't have any experience with this.

About searching the form: iirc it doesn't search for keywords <4 characters. So 'ssl' won't give results.

Though Google will do fine: https://www.google.nl/search?q=ssl+site ... simple.org

Re: SSL and relative urls

Posted: Thu Jan 01, 2015 7:06 am
by peterasap
Hi,

We call the news module in this way:

Code: Select all


               {news category="Popular courses" summarytemplate="Popular-home" number="8" detailtemplate="popular"}

Unfortunately, news modules does not create links with SSL i.e it creates absolute plain HTTP links. If needed I can make a patch in the module, but was hoping for a simpler solution that does not require change in PHP code as it will break during upgrades...

Re: SSL and relative urls

Posted: Sun Jan 04, 2015 9:01 pm
by peterasap
I solved the problem myself.

In case someone have it:

Open config.php and replace

Code: Select all

$config['root_url'] = 'http://www.example.com';  
with

Code: Select all

//$config['root_url'] = 'http://www.example.com';  
if($_SERVER['SERVER_PORT']=='443'){
  $config['root_url'] = 'https://www.example.com';  
}else{
   $config['root_url'] = 'http://www.example.com';    
    
}
Peter