## General plugins (Local): Static Pages

local_staticpage
Maintained by University of Ulm, Alexander Bias
Moodle plugin which displays information pages which exist outside any course, imprint or faq pages for example, complete with Moodle navigation and theme
13k
547
14

The local_staticpage plugin is designed to fetch a static HTML document from disk, enrich it with Moodle navigation and theme and deliver it as a standard Moodle page which exists outside any course.

Static pages will be available on catchy URLs like http://www.yourmoodle.com/static/faq.html and can be linked from Moodle HTML blocks, from your Moodle theme footer and so on. Using the local_staticpages plugin, you can create information pages within moodle, but without misusing a whole course just for showing a textbox.

### Contributors

Alexander Bias: Developer

• Wed, Apr 29, 2015, 5:48 PM
Hello Alexander
we have a problem with the plugin. We have installed it accordingly you're documantation Added a rewite rule in the .htaccess file in the html dir.
RewriteEngine On
RewriteRule ^/static/(.*)\.html$/local/staticpage/view.php?page=$1&%{QUERY_STRING} [L]

When we turn on the option Force Apache mod_rewrite we get an error:
error: File does not exist: /usr/local/moodle/test.uplearning.nl/html/static, referer: https://test.uplearning.nl/admin/settings.php

could you help us solving this problem

kind regards
• Thu, Apr 30, 2015, 2:31 AM
Hi Ed,

I know from several feedbacks that the rewrite option is not simple to setup and to use.

Does the plugin work without switching the "Force Apache mod_rewrite" setting on?

Alex
• Thu, Apr 30, 2015, 1:06 PM
Hello Alexander
yes. the rest of the plugin works fine. All the documents are added, except for,
The document should be available to at the following clean URL, but actually a browser won't be able to download and view it (perhaps there is something wrong with your webserver or mod_rewrite configuration - see README file for details):

I have tested the rewrite rule at http://htaccess.madewithlove.be/ works fine
Do you have any suggestions??

Ed
• Tue, May 5, 2015, 7:19 PM
Hi Ed,

I'd like to ask once again as it's not completely clear to me:
- If you turn the "Force Apache mod_rewrite" setting off, can you display a static page in Moodle?
- Where does the "error: File does not exist: /usr/local/moodle/test.uplearning.nl/html/static, referer: https://test.uplearning.nl/admin/settings.php" error message appear? On the Moodle settings page or when you try to open the static page in your browser?

Alex
• Wed, May 6, 2015, 1:55 PM
Hello Alex,
sorry for not being clear.
When the "Force Apache mod_rewrite" setting is off we can display the static pages.
The error is from the apache log and in the browser there is a message 404 error.

Eddy
• Wed, May 6, 2015, 3:30 PM
Hi Ed,

ok, if you can use the plugin without the rewrite rules, then the plugin is basically working and I can only provide limited support from here on because the rewrite problems are too heterogenous to discuss them in detail here...

The Apache error message tells you that it is looking for a file /usr/local/moodle/test.uplearning.nl/html/static and that file does not exist.

If you use the rewrite rule from https://github.com/moodleuulm/moodle-local_staticpage/blob/master/README.md and have built a URL for the static page like http://www.yourmoodle.com/static/faq.html, I would assume that the rewrite rule is _not_ in effect in your webserver because your webserver tells you that it can't find a file called "static" in your webroot - it does _not_ rewrite the URL to /local/staticpage/view.php?page=faq as it should. So, it's no problem of Moodle or the plugin, but of your webserver.

At this point, I would like to ask you to dig into your webserver configuration to see what's going wrong or ask someone who knows your environment better than I.

Thanks,
Alex
• Thu, Jul 2, 2015, 9:08 PM
Worked perfectly. Thank you!
• Sat, Jul 11, 2015, 8:22 PM
In the Document directory shows me that it found the folder, but when i click on the links under the Document list, it gives me 404 Not found.
Any ideas?
• Sun, Jul 12, 2015, 4:17 AM
please have a look at the comments above, I have explained basic pitfalls with the plugin several times.
My first question, as always, is if the plugin works without mod_rewrite, i.e. do the URLs containing /local/staticpage/view.php... work?

Alex
• Sun, Jul 12, 2015, 5:04 PM
Alexander,

Force Apache mod_rewrite box was unchecked.
"http://www.example.com/local/staticpage/view.php?page=sample"
and
"http://www.example.com/static/sample.html".

Then i found the reason,
Because in the Document directory i had "../staticpage", I've changed it to default how it shows under the "Document directory" and the "http://www.example.com/local/staticpage/view.php?page=sample" is working.
• Mon, Jul 27, 2015, 8:30 PM
Hi Alexander,

will this plugin work with 2.9 or should we wait for a new version?

Thanks, this is a great tool!

Giacomo
• Mon, Jul 27, 2015, 8:32 PM
Hi Giacomo,

our internal 2.9 update will be in August and we won't be able to test the
plugin thoroughly until then. Normally, the 2.8 version should work on 2.9
without problems. Please give it a try and report problems back to me if you
encounter any problems.

Thanks,
Alex
• Wed, Aug 5, 2015, 4:54 AM
Doesn't seem to work well on Moodle 2.9.
It shorten's the url and even lists the page all right. But when opened even from a link within moodle it opens with the page's own HTML formatting if any and not with moodle's formatting.
• Sat, Aug 22, 2015, 5:31 AM
Hi Gunasekar,

I was able to test the plugin on 2.9 and published a 2.9 version (without any new functionality).

Unfortunately, I wasn't able to reproduce your problems. Could you please post the link to the page you have mentioned so that I can have a look at it?

Thanks,
Alex
• Thu, Sep 3, 2015, 1:44 AM
When I add my page, no matter how I style it, it never extends past the half-way point of my page. I need it to stretch the entirety of the page and it will not. I do not understand what is wrong.

Example: https://university.hospicewr.org/local/staticpage/view.php?page=Example