Author |
|
fatted
Joined: 12 Apr 2007 Posts: 6
|
|
Back to top |
|
tdonovan Moderator
Joined: 17 Dec 2005 Posts: 611 Location: Milford, MA, USA
|
Posted: Fri 13 Apr '07 6:09 Post subject: |
|
|
Unlike Alias, AliasMatch does not work with just a URI prefix, but with the whole URI.
I think you want this:AliasMatch ^/(zone[0-9]*/.*) /opt/share/$1
What's going wrong with your current regex is:1 - your pattern translates /zone11/ to /opt/share/zone11
2 - since this is a directory, Apache appends index.html to the URI
3 - your pattern translates /zone11/index.html to /opt/share/zone11
4 - since this is a directory, Apache appends index.html to the URI (again!)
5 - your pattern translates /zone11/index.html/index.html to /opt/share/zone11
6 - etc., etc.
-tom-
p.s. If "zone" must always be followed by exactly two digits, and you don't want to require a trailing slash; this might be a better regex to use:AliasMatch ^/(zone[0-9]{2}(/.*)?) /opt/share/$1 which means $1 is "/zone followed by exactly two digits, optionally followed by (a slash followed by zero or more characters)".
-t- |
|
Back to top |
|
fatted
Joined: 12 Apr 2007 Posts: 6
|
Posted: Fri 13 Apr '07 11:22 Post subject: |
|
|
Thanks for the help!
I've tried this:
Quote: | AliasMatch ^/(zone[0-9]*/.*) /opt/share/$1 |
But some other craziness is now going on:
Make request:
http://www.myweb.com/zone12/
Browser (firefox), throws back as before:
http://www.myweb.com/zone12/index.html/index.html/index.html/....
And the access.log has the same request:
x.x.x.x - - [13/Apr/2007:10:05:02 +0100] "GET /zone12/index.html/index.html/...(etc) HTTP/1.1" 404 484
But the error.log has:
[Fri Apr 13 10:05:02 2007] [error] [client x.x.x.x] File does not exist: /opt/share/zone12/index.html
(which is what I'd expect to happen because the index.html file doesn't exist, but this doesn't match the access.log request...).
However when I create the index.html file, the access.log still reports the same error, but the error.log has changed to:
[Fri Apr 13 10:15:38 2007] [error] [client x.x.x.x] File does not exist: /opt/share/zone12/index.html/index.html/...(etc).
Any idea's? |
|
Back to top |
|
tdonovan Moderator
Joined: 17 Dec 2005 Posts: 611 Location: Milford, MA, USA
|
Posted: Fri 13 Apr '07 14:49 Post subject: |
|
|
Just checking .... you are using Apache 2.2, and you restarted Apache after changing httpd.conf?
I set up a similar config on Apache 2.2.4 and reproduced your exact symptoms with:AliasMatch ^/(zone[0-9]*)/ /opt/share/$1
It worked OK with:AliasMatch ^/(zone[0-9]*/.*) /opt/share/$1
-or-
AliasMatch ^/(zone[0-9]{2}(/.*)?) /opt/share/$1
-tom- |
|
Back to top |
|
fatted
Joined: 12 Apr 2007 Posts: 6
|
Posted: Fri 13 Apr '07 15:51 Post subject: |
|
|
Quote: | Just checking .... you are using Apache 2.2, and you restarted Apache after changing httpd.conf? |
Apache 2.0.58 |
|
Back to top |
|
fatted
Joined: 12 Apr 2007 Posts: 6
|
Posted: Fri 13 Apr '07 15:52 Post subject: |
|
|
Quote: | and you restarted Apache after changing httpd.conf?
|
yes |
|
Back to top |
|
fatted
Joined: 12 Apr 2007 Posts: 6
|
Posted: Fri 13 Apr '07 16:54 Post subject: Another way |
|
|
Maybe I should try this from a different angle:
How do I get the AliasMatch to display the directory contents instead of looking for an index.html? (and spiralling off into a loop)
(Similar to say "Alias /docs/ /opt/shares/" will display the contents of the directory /opt/shares/ and not return a couldn't find index.html message). |
|
Back to top |
|
tdonovan Moderator
Joined: 17 Dec 2005 Posts: 611 Location: Milford, MA, USA
|
Posted: Fri 13 Apr '07 17:12 Post subject: |
|
|
I don't get it....
As a test, I installed Apache 2.0.58 on a Linux (Debian Etch) system and configured it with the same directory names you are using - /opt/share/zoneNN.
I still see your exact symptoms with the original regex, but either of the two regex's I proposed corrects the problem on my system.
Do you have any other Alias* or Rewrite directives which might be contributing to the problem?
-tom- |
|
Back to top |
|
tdonovan Moderator
Joined: 17 Dec 2005 Posts: 611 Location: Milford, MA, USA
|
Posted: Fri 13 Apr '07 17:26 Post subject: |
|
|
One thing I noticed - be sure to clear your browser cache as well as restart Apache,
lest your browser makes it look like the new regex's don't work when they actually do.
-tom- |
|
Back to top |
|
fatted
Joined: 12 Apr 2007 Posts: 6
|
Posted: Fri 13 Apr '07 17:57 Post subject: |
|
|
Quote: | be sure to clear your browser cache |
I'm officially a muppet
Thanks for your help! |
|
Back to top |
|