Problem redirecting http to https

Re: Problem redirecting http to https

by Dave Langcaster -
Number of replies: 0
Hi Visvanath,

Thanks for the help with this. Yes, I did change the config.php, but I have now managed to fix it. The Moodle doc I mentioned in my post does say to create a .htaccess file, so I don't think it's strictly a Wordpress thing. The problem I had was that because I am running my main site on Wordpress there were numerous places where .htaccess lives and I wasn't sure which to edit. I have now discovered that it is the .htaccess in my /mydomain/public_html/moodle folder that I needed to edit. The contents of the file are as follows:

AddHandler application/x-httpd-php72 .php .php5
RLimitMem max

RewriteEngine On
RewriteCond %{ENV:HTTPS} !=on
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]

I'm not sure what the first 2 lines do (they were there to start with), but note the syntax in the last line - I was putting my actual https://mydomain rather than the URI placeholder text (if that's what you call it?)

I have posted this in the hope it helps anyone else who might be having the same issue.

Thanks again

Dave