.htaccess files

.htaccess files

by Tom Kleintjens -
Number of replies: 2

I'm trying to migrate a Moodle website from one server to a new (faster) server, but after two weeks of muddling I'm in desperate need of some guidance.

At the moment I'm stuck with two 'moodledata' directories, the one on the old website was placed inside the www-folder by our host but I'd rather place it outside, so this folder was copied to /moodledata

Now all of a sudden Moodle starts creating .htaccess files in 'httpdocs', 'admin' and 'themes' as it obviously finds something insecure. However these .htaccess files are causing the server to throw an error 500, the error_log stating that 'AllowOverride is not allowed here'.

Digging around this website I learned that an update to httd.conf was required to allow this, so contacted the host with the request to make alterations which they did. Still I'm running into error 500 until I remove the .htaccess file but as soon as I start to navigate through the site the file is recreated and we're back at the start.

How can I find out what is triggering this? or better yet solve it. Does this relate to folder permissions? the moodledata folder? or the Apache user not being able to access something. Starting to get lost in the various options here. Changing back the moodledata folder to the one inside the httpdocs folder makes no difference anymore either, which seems odd as aside from copying the files to the root location, they were not changed.

The server is running Linux Debian 3.2.60, Apache

php: 5.4.4

Moodle build: 2.6 (20131118) with the intention of upgrading to latest version, however impossible due to error 500

Any help greatly appreciated, as I know I still have an enrollment issue to tackle once the site is up and running, but I'm not even getting that far.

Average of ratings: -
In reply to Tom Kleintjens

Re: .htaccess files

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

The moodle program files should NOT be writeable by the web server. This is a big security risk. Clearly if they were not writeable then Moodle could not create these htaccess files. 

Moodle is going into 'limp home' mode because it detects these permissions problems. Delete the .htaccess files and check your permissions are correct. 

In reply to Howard Miller

Re: .htaccess files

by Tom Kleintjens -

Awesome, thank you so much for your swift response. I've modified file permission on the Moodle files and it is now working as expected. A small tweak with the external database view solved my problem with authentication/enrollment as well so we're going to be bringing the site live somewhere this week.

Once again, thank you for pointing me in the right direction.