You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Joyce Babu <jo...@joycebabu.com> on 2013/07/27 14:20:17 UTC

[users@httpd] Re: Mod_rewrite END flag does not work for directory index

When the rule is placed in the VirtualHost context, it works correctly. But
when it is placed in the Directory context or in an .htaccess file, the
request is mapped to the FallbackResource.

http://apaste.info/12Cw

Re: [users@httpd] Re: Mod_rewrite END flag does not work for directory index

Posted by Joyce Babu <jo...@joycebabu.com>.
I have worked around by setting an environment variable

RewriteEngine on
RewriteRule ^$ /test/home.php  [NC,QSA,END,E=IS_DIR_INDEX:1]
FallbackResource /test/fallback.php

<If "env('IS_DIR_INDEX') == 1">
 SetHandler default_handler
</If>




On Sun, Jul 28, 2013 at 1:21 PM, Joyce Babu <jo...@joycebabu.com> wrote:

> When SetHandler application/x-httpd-php is used, all files (including
> images) are served as text/html.
>
>
>
> On Sun, Jul 28, 2013 at 1:05 PM, Joyce Babu <jo...@joycebabu.com> wrote:
>
>>
>> On Sat, Jul 27, 2013 at 10:33 PM, Eric Covener <co...@gmail.com> wrote:
>>
>>> Just occurred to me that just NS flag may be enough too.
>>>
>>
>> It didn't work. According to the manual, NS flag will only prevent the
>> rules from being applied on sub requests.
>>
>>
>>>  On Sat, Jul 27, 2013 at 11:49 AM, Eric Covener <co...@gmail.com>
>>> wrote:
>>> >
>>> > My recollection is that END is designed to prevent looping from
>>> > rewrites own re-injection method during per-directory rewrites, which
>>> > differs from how mod_dir and mod_negotiation internally lookup and
>>> > then replace/redirect the active request.
>>> >
>>> > The method used by END does not propagate to those subrequests -- very
>>> > little does.  But maybe it would be possible for mod_rewrite to reach
>>> > back, but I think it may  require a new flag as some subrequests are
>>> > not replacing the current request.
>>>
>>
>> You are right. I tried disabling DirectoryIndex, and it worked correctly.
>> It is not passed to FallbackResource too.
>>
>>
>>> > I have a suspicion that maybe the 2.4 difference is related to not
>>> > having a default type anymore. It is quite a roundabout influence, but
>>> > you could maybe see if ForceType or SetHandler makes some kind of
>>> > difference if it's active on that context?
>>>
>>
>> SetHandler application/x-httpd-php worked. The file is being served
>> correctly, even though a sub request is still being issued for the
>> directory index file.  Should I report this as a bug in mod_dir/mod_rewrite?
>>
>> Thanks,
>> Joyce Babu
>>
>
>

Re: [users@httpd] Re: Mod_rewrite END flag does not work for directory index

Posted by Joyce Babu <jo...@joycebabu.com>.
When SetHandler application/x-httpd-php is used, all files (including
images) are served as text/html.


On Sun, Jul 28, 2013 at 1:05 PM, Joyce Babu <jo...@joycebabu.com> wrote:

>
> On Sat, Jul 27, 2013 at 10:33 PM, Eric Covener <co...@gmail.com> wrote:
>
>> Just occurred to me that just NS flag may be enough too.
>>
>
> It didn't work. According to the manual, NS flag will only prevent the
> rules from being applied on sub requests.
>
>
>>  On Sat, Jul 27, 2013 at 11:49 AM, Eric Covener <co...@gmail.com>
>> wrote:
>> >
>> > My recollection is that END is designed to prevent looping from
>> > rewrites own re-injection method during per-directory rewrites, which
>> > differs from how mod_dir and mod_negotiation internally lookup and
>> > then replace/redirect the active request.
>> >
>> > The method used by END does not propagate to those subrequests -- very
>> > little does.  But maybe it would be possible for mod_rewrite to reach
>> > back, but I think it may  require a new flag as some subrequests are
>> > not replacing the current request.
>>
>
> You are right. I tried disabling DirectoryIndex, and it worked correctly.
> It is not passed to FallbackResource too.
>
>
>> > I have a suspicion that maybe the 2.4 difference is related to not
>> > having a default type anymore. It is quite a roundabout influence, but
>> > you could maybe see if ForceType or SetHandler makes some kind of
>> > difference if it's active on that context?
>>
>
> SetHandler application/x-httpd-php worked. The file is being served
> correctly, even though a sub request is still being issued for the
> directory index file.  Should I report this as a bug in mod_dir/mod_rewrite?
>
> Thanks,
> Joyce Babu
>

Re: [users@httpd] Re: Mod_rewrite END flag does not work for directory index

Posted by Joyce Babu <jo...@joycebabu.com>.
On Sat, Jul 27, 2013 at 10:33 PM, Eric Covener <co...@gmail.com> wrote:

> Just occurred to me that just NS flag may be enough too.
>

It didn't work. According to the manual, NS flag will only prevent the
rules from being applied on sub requests.


>  On Sat, Jul 27, 2013 at 11:49 AM, Eric Covener <co...@gmail.com> wrote:
> >
> > My recollection is that END is designed to prevent looping from
> > rewrites own re-injection method during per-directory rewrites, which
> > differs from how mod_dir and mod_negotiation internally lookup and
> > then replace/redirect the active request.
> >
> > The method used by END does not propagate to those subrequests -- very
> > little does.  But maybe it would be possible for mod_rewrite to reach
> > back, but I think it may  require a new flag as some subrequests are
> > not replacing the current request.
>

You are right. I tried disabling DirectoryIndex, and it worked correctly.
It is not passed to FallbackResource too.


> > I have a suspicion that maybe the 2.4 difference is related to not
> > having a default type anymore. It is quite a roundabout influence, but
> > you could maybe see if ForceType or SetHandler makes some kind of
> > difference if it's active on that context?
>

SetHandler application/x-httpd-php worked. The file is being served
correctly, even though a sub request is still being issued for the
directory index file.  Should I report this as a bug in mod_dir/mod_rewrite?

Thanks,
Joyce Babu

Re: [users@httpd] Re: Mod_rewrite END flag does not work for directory index

Posted by Eric Covener <co...@gmail.com>.
Just occurred to me that just NS flag may be enough too.

On Sat, Jul 27, 2013 at 11:49 AM, Eric Covener <co...@gmail.com> wrote:
> On Sat, Jul 27, 2013 at 8:20 AM, Joyce Babu <jo...@joycebabu.com> wrote:
>> When the rule is placed in the VirtualHost context, it works correctly. But
>> when it is placed in the Directory context or in an .htaccess file, the
>> request is mapped to the FallbackResource.
>>
>> http://apaste.info/12Cw
>
> My recollection is that END is designed to prevent looping from
> rewrites own re-injection method during per-directory rewrites, which
> differs from how mod_dir and mod_negotiation internally lookup and
> then replace/redirect the active request.
>
> The method used by END does not propagate to those subrequests -- very
> little does.  But maybe it would be possible for mod_rewrite to reach
> back, but I think it may  require a new flag as some subrequests are
> not replacing the current request.
>
> I have a suspicion that maybe the 2.4 difference is related to not
> having a default type anymore. It is quite a roundabout influence, but
> you could maybe see if ForceType or SetHandler makes some kind of
> difference if it's active on that context?
>
> --
> Eric Covener
> covener@gmail.com



-- 
Eric Covener
covener@gmail.com

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


Re: [users@httpd] Re: Mod_rewrite END flag does not work for directory index

Posted by Eric Covener <co...@gmail.com>.
On Sat, Jul 27, 2013 at 8:20 AM, Joyce Babu <jo...@joycebabu.com> wrote:
> When the rule is placed in the VirtualHost context, it works correctly. But
> when it is placed in the Directory context or in an .htaccess file, the
> request is mapped to the FallbackResource.
>
> http://apaste.info/12Cw

My recollection is that END is designed to prevent looping from
rewrites own re-injection method during per-directory rewrites, which
differs from how mod_dir and mod_negotiation internally lookup and
then replace/redirect the active request.

The method used by END does not propagate to those subrequests -- very
little does.  But maybe it would be possible for mod_rewrite to reach
back, but I think it may  require a new flag as some subrequests are
not replacing the current request.

I have a suspicion that maybe the 2.4 difference is related to not
having a default type anymore. It is quite a roundabout influence, but
you could maybe see if ForceType or SetHandler makes some kind of
difference if it's active on that context?

-- 
Eric Covener
covener@gmail.com

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