Opened 18 years ago
Closed 18 years ago
#920 closed patch (fixed)
mythweb rewriting rules break when using Alias in httpd.conf
Reported by: | Owned by: | xris | |
---|---|---|---|
Priority: | minor | Milestone: | unknown |
Component: | mythtv | Version: | head |
Severity: | medium | Keywords: | |
Cc: | Ticket locked: | no |
Description
On my machine mythweb is located outside of the main document root by using this:
Alias /mythweb "/var/www/html/mythweb" <Directory "/var/www/html/mythweb"> ... </Directory>
This breaks with when using the new rewriting rules because the /var/... directory components appear to become part of the url. I get this error in the web browser:
The requested URL /var/www/html/mythweb/mythweb.php was not found on this server.
I get this error in the error_log:
[Mon Jan 02 19:51:22 2006] [error] [client 192.168.0.2] File does not exist: /srv/www/html/var, referer: https://localhost/
/srv/www/html is my real document root.
Tested against r8463.
Attachments (1)
Change History (8)
comment:1 Changed 18 years ago by
Summary: | mythweb rewriting rules break when using Aliasin httpd.conf → mythweb rewriting rules break when using Alias in httpd.conf |
---|
comment:2 Changed 18 years ago by
comment:3 Changed 18 years ago by
Full section is:
Alias /mythweb "/var/www/html/mythweb" <Directory "/var/www/html/mythweb"> SSLRequireSSL Options FollowSymLinks AllowOverride All Order allow,deny Allow from all AuthName xxx AuthType Basic AuthExternal pwauth require user xxx </Directory>
Nothing fancy, just relaxing the very strict defaults I have and adding basicauth.
comment:4 Changed 18 years ago by
Have you tried using the secondary rewrite code? It's the commented stuff near the bottom of the file (I just committed some stuff to rearrange it, it used to be on the very bottom). Uncomment the line that says mythweb.php?PATH_INFO=/$1 and comment out the one above it.
It's odd, though. I run a setup like this for trac, (with the alias and everything) and have no trouble with it. However, you may have to resort to using a symlink instead of the alias command.
Changed 18 years ago by
Attachment: | mythweb-rewritebase.patch added |
---|
Patch to add documentation on running mythweb outside of DocumentRoot?
comment:6 Changed 18 years ago by
Type: | defect → patch |
---|
Turns out that this is caused by the hacky implementation of mod_rewrite. Although it pretends to operate on URLs it actually operates on filenames with the directory part removed. Thus aliases cause it to break. The documentation at http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html explains to use 'RewriteBase?' so that mod_rewrite appends the correct base URL after rewriting.
Unfortunately it doesn't appear to be possible to use this 'RewriteBase?' in a way that will work no matter where mythweb is located, it needs to be customised for each location. Hence the patch I've just added simply puts a comment in the .htaccess file so people know how to work around this problem.
what are you using the <Directory> tags for?