Context support for AliasMatch?

Discussion in 'Bug Reports' started by nutz, Feb 26, 2008.

  1. nutz

    nutz Member


    I am trying to redirect an entire directory to a single file. With Apache, I used this:
    AliasMatch ^/dir /path/to/file
    I tried setting a "Static" Context like this:
    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:
    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:
    File not found [/.../dir/x]
    processContextPath() return 25
    processNewReq() return 25.
    HttpConnection::sendHttpError(),code=404 Not Found
    Does that give any clues?

  2. mistwang

    mistwang LiteSpeed Staff

    Please try

  3. nutz

    nutz Member

    Unfortunately, that has the same result and log entries.

    Btw, I am now using 3.3.5 (was using 3.3.4 at first).
  4. mistwang

    mistwang LiteSpeed Staff

    what's in the debug log?
  5. nutz

    nutz Member

    Here is the debug logging:
    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.
  6. mistwang

    mistwang LiteSpeed Staff

    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. nutz

    nutz Member

    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).

Share This Page