Wednesday, October 1, 2014

Add static pages to your moodle (2.7)

To add static pages to your Moodle (2.7):

1. Install this plugin (Addon):

Github repo:
Moodle plugin page:

2. Create a directory to store your static pages, by default it is:


set the correct permission for that folder:

$ sudo chown -R www-data:www-data /var/www/moodledata/staticpage

3. If you want the users to login before they can see those static pages, modify this file:


as following:

// Require login if Moodle is configured to force login
//if ($CFG->forcelogin) {
//    require_login();

4. Clean URL for your static pages:

By default, the static page can be access via this URL:


To make it pretty like this:


add this rewrite rule to your nginx configuration:

        location /static {
                rewrite ^/static/(.*)\.html$ /local/staticpage/view.php?page=$1;

Restart nginx:

$ sudo service nginx restart