Forum Moderators: phranque
I'm using a rule which works very well:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
RewriteRule ^/?$ main.php?lang=de-DE [L]
But some visitors told me that they have problems with timeouts while using the site. I have a similar problem on my localhost if I switch mod_rewrite on. I hope that the next error's are from the same problem.
I get this error in my apache log:
[Fri May 27 09:09:21 2005] [error] [client 127.0.0.1] (36)Resource deadlock avoided: mod_rewrite: failed to lock file descriptor
[Fri May 27 09:09:21 2005] [error] [client 127.0.0.1] (13)Permission denied: mod_rewrite: failed to unlock file descriptor
and this happens inside the rewrite log file: (this example shows only a few lines...)
127.0.0.1 - - [27/May/2005:09:15:12 +0200] [example/sid#575c70][rid#61e430/initial] (3) [per-dir c:/wwwroot/htdocs/example/] applying pattern '^/?$' to uri 'images/page_elements/bt_logo.swf'
127.0.0.1 - - [27/May/2005:09:15:12 +0200] [example/sid#575c70][rid#61e430/initial] (1) [per-dir c:/wwwroot/htdocs/example/] pass through c:/wwwroot/htdocs/example/images/page_elements/bt_logo.swf
is there somthing wrong in my rule?
[edited by: jdMorgan at 5:39 pm (utc) on May 28, 2005]
[edit reason] Examplified. [/edit]
I think you're running into problems when, after main.php gets loaded, the next request is for a graphic (like bt_logo.swf). This also gets processed by the rule, so it reloads main.php, and so on in a loop.
Perhaps you need to put in another condition:
RewriteCond ${REQUEST-URI} ^/$
That would limit the rewriting to only cases when the request is for the root directory.
Just a guess, but it may help.
The RewriteRule pattern is already sufficiently specific; It will be applied only to local URL-paths containing either "/" or "" (blank). Therefore, it will not rewrite any other requests, and an additional RewriteCond should not be needed. The RewriteLog clearly shows that the rule was not applied, because it states that the rule was "byassed."
The question is, why can't the lock file descriptor be accessed - why the lock file can't be accessed (locked or unlocked).
Are you (or your host) using RewriteMap? If so, make sure that the RewriteLock file is set to read/write permission, and also check the write permissions for the directory that this file resides in.
This looks like a file premissions problem, not a RewriteRule problem.
Jim