In our moodle installation, we have a directory containing a lot of static pages which are located in the moodle root-directory but which are not integrated into moodle-system: from the courses these pages are just linked. Problem is, these sites are visible/accessible for everyone who has the URL – but we would like these pages to be accessible only for logged-in moodle users. How we can accomplish this? Is it possible by altering the .htacces file?
Applying authentication/authorization for some non-moodle static HTML-pages
by Alexander Lebeth -
Number of replies: 2
In reply to Alexander Lebeth
Re: Applying authentication/authorization for some non-moodle static HTML-pages
by Dave Perry -
Could you not rename the static files all into .php files, then add the following code at the top of each page:
<?php
require_once("config.php");
require_login();
?>
This will force someone to be logged in to moodle before the rest of the page will load.
I suspect the .htaccess route will be out of the question, as there is no (to my knowledge) way for Apache to check if there is a moodle session.
In reply to Dave Perry
Re: Applying authentication/authorization for some non-moodle static HTML-pages
by Alexander Lebeth -
Thanks! Your solution is easy and works great!