Context support for AliasMatch?

#1
Hi,

I am trying to redirect an entire directory to a single file. With Apache, I used this:
Code:
AliasMatch ^/dir /path/to/file
I tried setting a "Static" Context like this:
Code:
URI = exp:^/dir
Location = $VH_ROOT/file
Accessible = Yes
"file" is in the virtual host root directory, but it isn't working. I also tried adding "(.*)" and "(.*)$" to the URI, with no effect.

If I change the Context to this:
Code:
URI = /dir/
Location = $VH_ROOT/file
Accessible = Yes
Then it works, but only for "/dir/", not "/dir/x".

Looking at the debug log with the first Context, I see these lines:
Code:
File not found [/.../dir/x]
processContextPath() return 25
processNewReq() return 25.
HttpConnection::sendHttpError(),code=404 Not Found
Does that give any clues?

Thanks.
 
#5
Here is the debug logging:
Code:
2008-02-26 21:25:50.249 [NOTICE] [...] Content len: 0, Request line: 
GET /dir/x HTTP/1.1
2008-02-26 21:25:50.249 [DEBUG] [...] Find .htaccess context with URI: [/], location: [/path/to/docroot/]
2008-02-26 21:25:50.249 [DEBUG] [...] File not found [/path/to/docroot/dir/x] 
2008-02-26 21:25:50.249 [DEBUG] [...] processContextPath() return 25
2008-02-26 21:25:50.249 [DEBUG] [...] processNewReq() return 25. 
2008-02-26 21:25:50.249 [DEBUG] [...] HttpConnection::sendHttpError(),code=404 Not Found
2008-02-26 21:25:50.249 [DEBUG] [...] HttpConnection::flush()!
2008-02-26 21:25:50.250 [DEBUG] [...] Written to client: 637
2008-02-26 21:25:50.250 [DEBUG] [...] HttpConnection::nextRequest()!
Let me know if you need any additional info.
 

mistwang

LiteSpeed Staff
#6
I think you have "/" context defined, so the order of contexts are important. You need change the sequence number of the regex context, make it smaller than that of "/" context.
 
#7
I don't have any "/" Context (or redirect), but I think I have found the trigger now! The problem happens if there are any "RedirectMatch" directives in the .htaccess file (plain "Redirect" are OK).
 
Top