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 ^(/)?$ moodledir/index.php [L]
Please note that this would work for all file url requests like view.php or index.php but not file.php requests. Another rule needs to be written for that.
Comments
2 Comments so far
I just signed up to your blogs rss feed. Will you post more on this subject?
I may.. had some ideas on making moodle links appear non-moodle… what are you looking forward to achieve?