Moodle Login page redirects to a wrong URL

Moodle Login page redirects to a wrong URL

by Ayyaz Qamar -
Number of replies: 9

Hi 


I am the Moodle admin for a training institute. Yesterday, I configured Self Registration & Paypal Registration to out program and saved it. I saved the details and logged-out. Now when I click on Login link, instead of redirecting it to correct login URL which is given below;

https://www.mydomain.com/ocen/moodle/login/index.php

It redirects to my website "https://www.mydomain.com/online", 

Therefore, I am not able to access the login section. Could anyone advise how can I log in to the admin section in the absence of a login page? 


Your help will be highly appreciated. 

Average of ratings: -
In reply to Ayyaz Qamar

Re: Moodle Login page redirects to a wrong URL

by Ken Task -
Picture of Particularly helpful Moodlers

What's in the /ocen/ directory?

Do you have a WordPress or something else running at /online/?

Do you have a web service redirect setup? .htaccess or in main config file for web service?

In your browser, without trying to login go directly to https://yoursite/moodle/admin/settings.php?section=manageenrols

That's where you'll find PayPal settings link.

Could also turn it off there.

'spirit of sharing', Ken




In reply to Ken Task

Re: Moodle Login page redirects to a wrong URL

by Ayyaz Qamar -

Hi Ken


Thank you very much for your kind response. 


OCEN directory just has Moodle in it. 

Wordpress runs online on the same domain

I am not sure about redirect setup, could you please advise what would be the best way to see if Moodle redirection is active or not?

When I tried to go to the link you suggested, it again took me to the same redirected page. 


I shall look forward to hearing from you.


Regards

In reply to Ayyaz Qamar

Re: Moodle Login page redirects to a wrong URL

by Ken Task -
Picture of Particularly helpful Moodlers

In your first posting you said the url to login was site/ocen/moodle/ Is there a config.php file in /ocen/ or is there a moodle directory inside ocen and inside the 'moodle' directory there a config.php file?

Think WordPresses have plugins for redirects ... check WP config.

Redirects can be done in multiple ways ... kinda depends upon if one is running Apache/Nginx/IIS on Windows, etct.

So I can do no more other than to point you to Apache Docs .... assuming you are running Apache:

https://httpd.apache.org/docs/2.4/rewrite/remapping.html

nginx

https://www.nginx.com/blog/creating-nginx-rewrite-rules/

rewrites from .htaccess .... the following from a hosting provider that may/may not fit your situation.

https://help.dreamhost.com/hc/en-us/articles/215747748-How-can-I-redirect-and-rewrite-my-URLs-with-an-htaccess-file-

In the config of PayPal ... their end ... did you have to enter any 'call back url' that points back to your site?

Ken

In reply to Ken Task

Re: Moodle Login page redirects to a wrong URL

by Ayyaz Qamar -

Hi Ken

there is a moodle directory inside ocen and inside the 'moodle' directory there a config.php file


to the best of my knowledge, I have not set-up any redirection, not I entered 'call back URL'. 


Is there any way I can log in as the administrator to the login and disable the new plugins what apparently caused the issue?   


I really appreciate your time in this regard. 


Thanks

In reply to Ayyaz Qamar

Re: Moodle Login page redirects to a wrong URL

by Ken Task -
Picture of Particularly helpful Moodlers

That direct URL was an attempt to get you to the area where one could check setting or disable plugins.

So of that one got re-directed am thinking it has to be outside of Moodle.

Have you checked for .htaccess files present?  Have you checked the main httpd.conf (you still haven't said if you are using Apache or not) for any redirect.

Have you checked apache/web service logs (error log) for clues?

Now we've said 'new plugins' ... so what new plugins?   PayPal is one we know about ... others?

There is a script in moodlecode/admin/cli/ called cfg.php

ssh into server and su to root ... cd to above.

Then issue: php cfg.php --help

That script appears to have the ability to set/unset 

    --set=<value>               Set the given variable to this value.
    --unset                     Unset the given variable.

If you issue just: php cfg.php that displays all the settings - and am hoping paypal and other plugins show up.

Look for lines related to the plugins to get their names and if possible, try the unset.

'spirit of sharing', Ken


In reply to Ken Task

Re: Moodle Login page redirects to a wrong URL

by Ayyaz Qamar -

Hi Ken, thanks for your prompt response. I shall try to follow and instruction and see if it works and will update here. 

In reply to Ayyaz Qamar

Re: Moodle Login page redirects to a wrong URL

by Ken Task -
Picture of Particularly helpful Moodlers

Was the site http and you recently acquired a valid CA and you setup https on that server?

Reason I ask .... many folks do have a re-write rule to force all http:// traffic to https://.   On CentOS 7 (sure would be nice to know what OS your machine runs) that redirect rule could be in the main config file for Apache (here again, you've not said what you are running) which is in /etc/httpd/conf/ and called httpd.conf

That setup of rewrite could also be in /etc/httpd/conf.d/ssl.conf - for https

Help yourself ... by providing information to those willing to help.   No info ... then it's all guess and eventually those willing to help will tell you that you are on your own! :|

Sent you a PM with my addy and requested information.   Please use and provide the info or I'll have end this conversation wishing you luck! :|

Ken



In reply to Ayyaz Qamar

Re: Moodle Login page redirects to a wrong URL

by Ken Task -
Picture of Particularly helpful Moodlers

Found your site.

Looks like you got it fixed.

Please do share back what was wrong and how you fixed.   Others might find themselves in similar situation and your posting could provide a solution for them as well.

'spirit of sharing', Ken


Average of ratings: Useful (1)
In reply to Ken Task

Re: Moodle Login page redirects to a wrong URL

by Polikarpos Skapinakis -

Hi 
I had a similar problem 
WP site at  www.domain.com/ and moodle site   moodle.domain.com/ at /moodle direcory
Moodle admin was redirected to moodle.domain.com/my/
I thought the error was in the .htaccess file of my wordpress site but all I had to do was

Log into your Wordpress Admin and then goto Settings->General and change your Wordpress URL to www.domain.com/

source

Hope I help someone