You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2010/07/31 22:23:02 UTC

DO NOT REPLY [Bug 49682] New: Non-redirect RewriteRule not working with VirtualDocumentRoot

https://issues.apache.org/bugzilla/show_bug.cgi?id=49682

           Summary: Non-redirect RewriteRule not working with
                    VirtualDocumentRoot
           Product: Apache httpd-2
           Version: 2.2.3
          Platform: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: mod_rewrite
        AssignedTo: bugs@httpd.apache.org
        ReportedBy: juustunagu@hotmail.com


Using RewriteRule in virtualhost with VirtualDocumentRoot causes File Not Found
error on url that matches that rule.

I have 2 vhosts blocks - for trunk and for branches. Conf:

-- conf start --
<VirtualHost *:80>
    ServerName example.com

    DocumentRoot /srv/www/trunk

    RewriteEngine On
    RewriteRule ^/a/_(.+)$ /a/rew-$1
</VirtualHost>

<VirtualHost *:80>
    # get the server name from the Host: header
    UseCanonicalName Off

    ServerAlias *.example.com

    VirtualDocumentRoot /srv/www/branches/%1

    RewriteEngine On
    RewriteRule ^/a/_(.+)$ /a/rew-$1
</VirtualHost>
-- conf end --

Expected Results:
http://foo.example.com/a/_foo.txt maps to http://foo.example.com/a/rew-foo.txt

Actual Result:
404 File Not Found


BUT!

This works (not using VirtualDocumentRoot):
http://example.com/a/_foo.txt maps to http://example.com/a/rew-foo.txt

This also works (change in 2nd vhost block):
...
RewriteRule ^/a/_(.+)$ /a/rew-$1 [R]
...
http://example.com/a/_foo.txt is redirected to http://example.com/a/rew-foo.txt


Platform:
$ cat /etc/SuSE-release
SUSE Linux Enterprise Server 10 (x86_64)
VERSION = 10
PATCHLEVEL = 2

$ uname -a
Linux XXX 2.6.27.45-0.1-xen #1 SMP Tue May 11 15:36:17 EEST 2010 x86_64 x86_64
x86_64 GNU/Linux

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 49682] Non-redirect RewriteRule not working with VirtualDocumentRoot

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49682

Eric Covener <co...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID

--- Comment #2 from Eric Covener <co...@gmail.com> 2010-07-31 18:31:20 EDT ---
Use the PT flag in virtualhost context if you want modules like mod_vhost_alias
to have a chance to work on the changed URL.  Further discussion at
users@httpd.apache.org.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 49682] Non-redirect RewriteRule not working with VirtualDocumentRoot

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49682

juustunagu@hotmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         OS/Version|                            |All

--- Comment #1 from juustunagu@hotmail.com 2010-07-31 16:25:32 EDT ---
Made a mistake in BUT.... :) URLs should have been foo.example.com

This also works (change in 2nd vhost block):
...
RewriteRule ^/a/_(.+)$ /a/rew-$1 [R]
...
http://foo.example.com/a/_foo.txt is redirected to
http://foo.example.com/a/rew-foo.txt

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org