Entire site from http to https ?

Entire site from http to https ?

Anthony M -
回帖数:3

Hi everyone,

We are planning to change the settings in our site to use https in all pages (at the moment is only in login page), but reading the thread here I am not sure about what is going to stop working if we go for that change. 

I see that Mark in that thread has problems with...

  • Restored courses not properly modifying course IDs in some linked documents (especially those pointing to Legacy files);
  • "Connection error" messages that require users to refresh their pages (sometimes resulting in loss of data in submitted forms).


I guess that pasted links in forums, url activities, scorm... will still work as normal as in the first post in this link (in the https://moodle.org/ ) there is an http link and is working right. 


Anyone have done the change to SSL and had problem after the change?


Any help is highly appreciated.


回复Anthony M

Re: Entire site from http to https ?

Ken Task -
Particularly helpful Moodlers的头像

Have recently had some experiences with this very same thing.

Make sure your site responds to an https:// request ... even if it's using a localhost generated cert.   Port 443 is used so in firewall, that has to be opened and if using apache (you've not said what/which), one might have to check the virual host or default host setup for https://.

First, +1 for what Luis posted.   Just one point ... the search needs to be for http://yourdomain/[moodle]/ and replace with https://yourdomain/[moodle]/ [moodle]/ if that's how your's is setup.

What I normally do ... create another blank DB for the moodle with required character set and collation, but name it 'moodlessl'.    Do a mysldump of current DB.   Edit the dumped sql with a text editor that has search and replace ... search for http://yourdomain/  replace with https://yourdomain/  ... the http infront is important and as is the trailing slash.

Once the edited sql dump as had all the internal to the moodle links changed from http:// to https:// then import the edited sql into the moodlessl DB.

Then just three more steps ...  get the true certs/keys in place and restart web service.   Check to see the cert is valid and working as expected (icon in browser URL line allows one to do that). 

Edit the config.php file.   Copy the  of the wwwroot variable line so you have two of them ... comment out one ... change http to https in the other.  Copy the line for the DB name (you have two of them then), comment out the original and change the other for the new 'moodlessl' DB.

No need to restart web service now ... just hit with browser.

One catch 22 ... if there were internal links in a html block those may not have been fixed with search and replace.  For some reason, html blocks HTML isn't in raw html so search and replace couldn't find them to change.   Easy to fix ... just re-edit.

As is always good practice, do a full site *BACKUP* - sql dump, code directory, data directory **before** venturing.  If minimal ... config.php and a sql dump - just in case something goes haywire.

Oh, yeah ... one more item ... all of the users may have been told site is moving to https:// but bet $'s NONE will edit their favorites/bookmarks, etc. for a while. :\  When accessing the https:// site now, moodle will display a screen informing the user https:// must be used.   But it doesn't auto forward like it used to.   I edit the language file and find that warning ... then add a reminder to change their favorite/bookmark and add a 'click here' link to take them to the site.   Yes, one could do auto forward as a re-write rule ... but have found that to bites in certain cases.

Got any users using the Modole iPhone/Android app?  Might research that and provide info for users that have http in their app and how to change that in the app.

'spirit of sharing', Ken



回复Anthony M

Re: Entire site from http to https ?

Anthony M -

Hi guys, 

Thanks a lot for that tips. We finally moved our entire site to https but now we are having problems with some of the SCORMs...

"Not Found. The requested URL /Content/.../page0.htm was not found on this server""


I guess the problem should be with that scorms containing link urls to http. 


Anyone with the same problem?