Can't login after switching to https-login

Can't login after switching to https-login

by Eckart Stoermer -
Number of replies: 13
I just installed Moodle 1.8. First I didn't use https for login. Then I installed ssl on the server and switched to https-login. Now I can't log in and "404 not found" is shown. Now I've got two questions.

1. Where can I switch off https-login?

2. Why it doesn't work? Do I have to reinstall moodle, first install ssl and then moodle. Will this work?

Thanks for help. anerkennend

Average of ratings: -
In reply to Eckart Stoermer

This forum post has been removed

The content of this forum post has been removed and can no longer be accessed.
In reply to Eckart Stoermer

Re: Can't login after switching to https-login

by Dennis Flynn -
There's a database setting to change your login back to http. Not sure where, so search the forums and I'm sure you'll find it.
In reply to Eckart Stoermer

Re: Can't login after switching to https-login

by Matt Gibson -
You need to install phpmyadmin on your server and connect to your moodle database so you can make changes. Then run this SQL query:

UPDATE mdl_config SET value = 0 WHERE name = 'loginhttps'

you may need to alter mdl_ if you used a different prefix.
Average of ratings: Useful (2)
In reply to Matt Gibson

Tárgy: Re: Can't login after switching to https-login

by Pál Csányi -
What is the correct SQL query when one have PostgreSQL instead of MySQL database server?
In reply to Pál Csányi

Tárgy: Re: Can't login after switching to https-login

by Pál Csányi -
I find the correct SQL query:
UPDATE mdl_config SET value = 0 WHERE name = 'loginhttps';
so it's the same but one must to add ";" character at the end of the command.
This is maybe an issue on the MySQL too.
In reply to Eckart Stoermer

Re: Can't login after switching to https-login

by Nigel Singleton -
I'm plaaning to install an SSL certificate in the domain where moodle can be found because I am running a shop off it. Is this going to cause me problems judging from the posts here?
In reply to Nigel Singleton

Re: Can't login after switching to https-login

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
Nigel - Not likely provided your SSL certificate is installed and your webserver is setup for ssl first and then you switch Moodle to use https to login you should be fine. Where folks sometimes get into trouble is they say to use ssl before they have installed it and then they cannot login to Moodle so they have to use a tool like phpmyadmin to switch that setting back. So as long as you don't put the cart before the horse you should be fine. Peace - Anthony
Average of ratings: Useful (1)
In reply to Anthony Borrow

Re: Can't login after switching to https-login

by Prashant Rais -

Hi Anthony,

I had swithed loginhttps before turning on HTTPS on web server.

Now when I am trying to fix this by doing:

1. turn off httpslogin in db.

2. turn off SSL on apache.

3. login with http as admin and check httpslogin : menu: security>HTTP Secruity>httpslogin unchecked.

4. remain logged as admin in one browser.

5. open another browser and login as normal test user. am logged in. (no ssl, no httpslogin)

6. turn on httpslogin from admin.

7. turn on SSL on apache. re-start apache.

8 try to login as test user again. fails.

Am i doing something wrong?

Please help.

In reply to Prashant Rais

Re: Can't login after switching to https-login

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers

I'm not sure you are doing something wrong but I would go back and do step 1 and make sure Moodle is not requiring you and your users to use https for login. Then you can manually test any page by changing http to https in your browser to ensure that the apache server is working with ssl. Once you do that, then you should be able to enable httpslogin without issue. I also get suspicious of browser cache's but lets make sure that the ssl option is working properly before requiring it. Let me know if you have any other questions. Peace - Anthony

In reply to Anthony Borrow

Re: Can't login after switching to https-login

by Prashant Rais -

That Worked !.

Thanks Anthony.

So my vhost config file looks like :

 

<Directory  "c:/xampp/htdocs/pival/coe19/login">
Options Indexes FollowSymLinks +Includes
AllowOverride All
Order allow,deny
Allow from all
SSLRequireSSL
</Directory>
But when i insert the mod_rewrite code inside the <VirtualHost *:80>
as :
<IfModule mod_rewrite.c>
RewriteEngine On
# Redirect /login folder to https
RewriteCond %{HTTPS} !=on
RewriteCond %{REQUEST_URI} login
RewriteRule ^(.*) https://%{SERVER_NAME}$1 [R,L]
</IfModule>
i cannot login to moodle.
What am i doing wrong?
pls help.
In reply to Prashant Rais

Re: Can't login after switching to https-login

by Prashant Rais -

Fixed that too. some syntax error.

 

Works fine now.!!

In reply to Prashant Rais

Re: Can't login after switching to https-login

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers

I'm not an apache expert, but as I recall I did not use mod_rewrite but instead ssl and port 443. You should be able to find some documentation pretty easily about enabling ssl on apache servers. Peace - Anthony

In reply to Anthony Borrow

Re: Can't login after switching to https-login

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers

Actually I do not really know XAMPP as I've always just installed Apache, PHP, and MySQL independently. It is worth the learning curve IMHO. In any case, I did a quick Google of how to enable SSL on XAMPP and the following link may be of help http://www.debianhelp.co.uk/xampp.htm - I was not aware of the startssl option. Peace - Anthony