I've got a rewriterule that works for everything exc开发者_开发技巧ept the lib folder. The rule is
RewriteRule ^/uk(.*) $1
It's one of a much more complex set of rules but I've disabled all but this one. The rule works fine for everything but the contents of the lib folder:
http://site.local/lib/cookies.js works but http://site.local/uk/lib/cookies.js doesn't.
Every other path on the site redirects fine eg:
http://site.local/uk/course/view.php?id=15 goes to http://site.local/course/view.php?id=15
- other folders with only three letters in their name work.
- uk/otherpath/lib works.
- there is no htaccess file in the lib folder
- there is no htaccess file in the site root (the rules are in the virtual host definition)
- the issue occurs on ubuntu and redhat (dev and production)
- the issue occurs on another moodle site on a colleagues workstation
- the permissions on the lib folder are identical to the rest of the directory tree
What am I missing?!? HELP!!!!!!!!!
--- EDIT ---
RewriteLog "/var/log/apache2/rewrite.log"
RewriteLogLevel 9
Gives me
127.0.0.1 - - [22/Sep/2011:11:21:57 +0100] [site.local/sid#7f15a0b345d0][rid#7f15a0e1b270/initial] (2) init rewrite engine with requested uri /uk/lib/cookies.js
127.0.0.1 - - [22/Sep/2011:11:21:57 +0100] [site.local/sid#7f15a0b345d0][rid#7f15a0e1b270/initial] (3) applying pattern '^/uk(.*)' to uri '/uk/lib/cookies.js'
127.0.0.1 - - [22/Sep/2011:11:21:57 +0100] [site.local/sid#7f15a0b345d0][rid#7f15a0e1b270/initial] (2) rewrite '/uk/lib/cookies.js' -> '/lib/cookies.js'
127.0.0.1 - - [22/Sep/2011:11:21:57 +0100] [site.local/sid#7f15a0b345d0][rid#7f15a0e1b270/initial] (2) local path result: /lib/cookies.js
127.0.0.1 - - [22/Sep/2011:11:21:57 +0100] [site.local/sid#7f15a0b345d0][rid#7f15a0e1b270/initial] (1) go-ahead with /lib/cookies.js [OK]
127.0.0.1 - - [22/Sep/2011:11:21:57 +0100] [site.local/sid#7f15a0b345d0][rid#7f15a0e232b0/initial] (2) init rewrite engine with requested uri /favicon.ico
127.0.0.1 - - [22/Sep/2011:11:21:57 +0100] [site.local/sid#7f15a0b345d0][rid#7f15a0e232b0/initial] (3) applying pattern '^/uk(.*)' to uri '/favicon.ico'
127.0.0.1 - - [22/Sep/2011:11:21:57 +0100] [site.local/sid#7f15a0b345d0][rid#7f15a0e232b0/initial] (1) pass through /favicon.ico
So it looks to me like that should work?
After messing about with this on my local machine, it would appear that Apache is rewriting to /lib on your file system before checking for the document_root/lib directory.
You should change your Rewrite to:
RewriteRule ^/uk(.*) %{DOCUMENT_ROOT}$1
I'd suggest turning on RewriteLog and increasing the RewriteLogLevel to get further information about what Apache is doing.
精彩评论