May
23
Moodle mod rewrite
May 23, 2010 | 2 Comments
# Turn on rewrites.
RewriteEngine on
# Only apply to URLs on this domain
RewriteCond %{HTTP_HOST} ^(www.)?mysite.com$
# Only apply to URLs that aren’t already under folder.
RewriteCond %{REQUEST_URI} !^/moodledir/
# Don’t apply to URLs that go to existing files or folders.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all those to insert /folder.
RewriteRule ^(.*)$ /moodledir/$1
# Also redirect the root folder.
RewriteCond %{HTTP_HOST} ^(www.)?mysite.com$
RewriteRule [...]
May
23
Moodle migration in 3 steps
May 23, 2010 | Leave a Comment
1. Copy all files from the root of your Moodle installation and the moodle data directory.
#rsync -av -e ssh sourse/ username@newserver.com:/path/to/destination/
2. Dump your Moodle database and import it it new server
#mysqldump –allow-keywords –opt -uMySQL_USERNAME -pPASSWORD DATABASE | ssh username@newserver.com “mysql -uMySQL_USERNAME -pPASSWORD DATABASE”
3. Edit config.php to update all database access details, file paths and web [...]
May
12
htaccess cheatsheet
May 12, 2010 | Leave a Comment
Enable Directory Browsing
Options +Indexes
## block a few types of files from showing
IndexIgnore *.wmv *.mp4 *.avi
Disable Directory Browsing
Options All -Indexes
Customize Error Messages
ErrorDocument 403 /forbidden.html
ErrorDocument 404 /notfound.html
ErrorDocument 500 /servererror.html
Get SSI working with HTML/SHTML
AddType text/html .html
AddType text/html .shtml
AddHandler server-parsed .html
AddHandler server-parsed .shtml
# AddHandler server-parsed .htm
Change Default Page (order is followed!)
DirectoryIndex myhome.htm index.htm index.php
Block Users from accessing the site
<limit GET [...]