# 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

  1. badmash on October 23, 2010 8:53 am

    I just signed up to your blogs rss feed. Will you post more on this subject?

  2. admin on October 23, 2010 5:02 pm

    I may.. had some ideas on making moodle links appear non-moodle… what are you looking forward to achieve?

Name (required)

Email (required)

Website

Speak your mind