I installed moodle in a subdirectory and would like to do a cloaked htaccess redirect from my root to the sub.
Example: http://mysite.com REDIRECTS TO http://mysite.com/moodledir
I would like the user to see http://mysite.com as the URL.
Can anyone help me with the htaccess file?
Sorry, can't answer your question, but is there any reason why you can't just move the files to root and change config.php?
Regards
H
Regards
H
Yes that would work fine but I'm more comfortable but putting the new files in a separate sub-dir when upgrading. By doing that I can get everything working before doing the switch rather than having something go wrong and ending up with my site being down.
OK, got me curious so had a hunt around and I believe the following should do what you want:
Change the bits in red (which are based on your original example) to the real domain/directory and you can ditch the comments if you want.
# 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]
Change the bits in red (which are based on your original example) to the real domain/directory and you can ditch the comments if you want.
Same issue, and the rewrite works, however anything requested with file.php is not rewritten correctly.
For example I have file resources available in the front page course. These files are not found by clicking on the relevant links
such as http://www.mysite.com/file.php/1/all_courses/Acknowledgement.pdf
I get "No input file specified"
but if I manually add the directory (in red) to the link like this
http://www.mysite.com/moodledir/file.php/1/all_courses/Acknowledgement.pdf
the file displays/downloads correctly.
Can there be a rewrite condition to put the moodledir for file requests by file.php?
Interesting point is the view.php does work correctly, just not file.php requests.
For example I have file resources available in the front page course. These files are not found by clicking on the relevant links
such as http://www.mysite.com/file.php/1/all_courses/Acknowledgement.pdf
I get "No input file specified"
but if I manually add the directory (in red) to the link like this
http://www.mysite.com/moodledir/file.php/1/all_courses/Acknowledgement.pdf
the file displays/downloads correctly.
Can there be a rewrite condition to put the moodledir for file requests by file.php?
Interesting point is the view.php does work correctly, just not file.php requests.
Hi, I know this is an OLD post. I'm debugging the same exact problem with my current host. I'll post when I find a solution.