FULL disable of login/forgot_password.php

FULL disable of login/forgot_password.php

by Anze Pratnemer -
Number of replies: 6

Greetings,


I am aware of link removal for lost password from login form on first page, already implemented that. But google is now finding my moodle instance and first result is pointing to www.mywebsite.com/login/forgot_password.php instead of www.mywebsite.com. We are not using forgot password or username recovery via this functionality, we are on LDAP..


Dont know why and when google will remove this and I dont have time to wait, thus asking, is there any option that I can check that simply redirects everything coming to this page login/forgot_password.php to somewhere else?


I know I can modify forgot_password.php to do simple redirect, but I really dont want to change core that is gonna get overwritten in a week..

Attachment google.png
Average of ratings: -
In reply to Anze Pratnemer

Re: FULL disable of login/forgot_password.php

by Dave Perry -
Picture of Testers

You need to report this to google so they fix it (their robots have picked it up that way, and that's not something you can probably fix).

Try this blog post:
https://moz.com/blog/how-to-fix-crawl-errors-in-google-search-console

Average of ratings: Useful (1)
In reply to Dave Perry

Re: FULL disable of login/forgot_password.php

by Anze Pratnemer -

OK, i can do that, but still would like to disable that page, I really dont want anybody else to access it.. Is there a way?

In reply to Anze Pratnemer

Re: FULL disable of login/forgot_password.php

by Dave Perry -
Picture of Testers

This is NOT a substitute for fixing your google entry - but if you rename the file on the server, it will be unavailable.

OR create a copy of it, and then change the original file's content to be:

<?php
header("Location: https://www.yourmoodlesite.whatever");
?>

which will basically redirect anyone who hits that script back to your moodle homepage.

Average of ratings: Useful (1)
In reply to Dave Perry

Re: FULL disable of login/forgot_password.php

by Anze Pratnemer -

Yes, that's one solution, but its not pretty, since this core code change will be overwritten in next moodle upgrade.


Thank you for now, will probably do it like that and make a mental (or actual postIt) note to fix this file on next moodle update.

In reply to Anze Pratnemer

Re: FULL disable of login/forgot_password.php

by Iñaki Arenaza -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

You can always make that redirection in your web server, before it even hits Moodle.

Saludos. Iñaki.

Average of ratings: Useful (1)