You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Dennis Jacobfeuerborn <de...@conversis.de> on 2010/11/05 03:10:56 UTC
[users@httpd] Forcing custom 404 error page instead of autoindex
Hi,
I'm trying to find a way to always generate a 404 error using htaccess when
a directory is accessed and with mod_autoindex enabled.
That is when I access http://server/directory/ I want to get a 404 error
instead of an auto generated index.
I tried doing this with a RewriteRule but the autogenerated index gets
displayed anyway and disabling the Index with "Options -Indexes" only gives
me a 403 instead of a 404.
Is there a way to do this?
Regards,
Dennis
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Forcing custom 404 error page instead of autoindex
Posted by Dennis Jacobfeuerborn <de...@conversis.de>.
On 11/05/2010 05:08 AM, Eric Covener wrote:
> On Thu, Nov 4, 2010 at 10:45 PM, Dennis Jacobfeuerborn
> <de...@conversis.de> wrote:
>> ErrorDocument 404 /_disabled/index.html
>> RewriteEngine on
>> RewriteRule !/_disabled/ /_force_404_
>>
>> The idea was to use the rewrite rule to rewrite any access to a non-existing
>> page and then have the ErrorDocument directive catch that but instead of a
>> custom error page I only get the default message "The requested URL
>> /_force_404_ was not found on this server."
>>
>
> That's backwards. You can use R=404 in the flags of a rewriterule.
That works indeed, thanks. I could have sworn I tried this before and it
failed but that was probably for some other reason since I was juggling
around a bit with different configuration options. Anyway this works as
intended:
ErrorDocument 404 /_disabled/index.html
RewriteEngine on
RewriteRule .* - [R=404,L]
Regards,
Dennis
>> Regards,
>> Dennis
>>
>> On 11/05/2010 03:31 AM, Igor Cicimov wrote:
>>>
>>> Post the rewrite rule here.
>>>
>>> Igor
>>>
>>>> On Nov 5, 2010 1:11 PM, "Dennis Jacobfeuerborn"<dennisml@conversis.de
>>>> <ma...@conversis.de>> wrote:
>>>>
>>>> Hi,
>>>> I'm trying to find a way to always generate a 404 error using htaccess
>>>> when a directory is accessed and with mod_autoindex enabled.
>>>> That is when I access http://server/directory/ I want to get a 404 error
>>>> instead of an auto generated index.
>>>>
>>>> I tried doing this with a RewriteRule but the autogenerated index gets
>>>> displayed anyway and disabling the Index with "Options -Indexes" only
>>>> gives me a 403 instead of a 404.
>>>>
>>>> Is there a way to do this?
>>>>
>>>> Regards,
>>>> Dennis
>>>>
>>>> ---------------------------------------------------------------------
>>>> The official User-To-User support forum of the Apache HTTP Server
>>>> Project.
>>>> See<URL:http://httpd.apache.org/userslist.html> for more info.
>>>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>>>> <ma...@httpd.apache.org>
>>>> " from the digest: users-digest-unsubscribe@httpd.apache.org
>>>> <ma...@httpd.apache.org>
>>>> For additional commands, e-mail: users-help@httpd.apache.org
>>>> <ma...@httpd.apache.org>
>>>>
>>
>>
>> ---------------------------------------------------------------------
>> The official User-To-User support forum of the Apache HTTP Server Project.
>> See<URL:http://httpd.apache.org/userslist.html> for more info.
>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>> " from the digest: users-digest-unsubscribe@httpd.apache.org
>> For additional commands, e-mail: users-help@httpd.apache.org
>>
>>
>
>
>
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Forcing custom 404 error page instead of autoindex
Posted by Eric Covener <co...@gmail.com>.
On Thu, Nov 4, 2010 at 10:45 PM, Dennis Jacobfeuerborn
<de...@conversis.de> wrote:
> ErrorDocument 404 /_disabled/index.html
> RewriteEngine on
> RewriteRule !/_disabled/ /_force_404_
>
> The idea was to use the rewrite rule to rewrite any access to a non-existing
> page and then have the ErrorDocument directive catch that but instead of a
> custom error page I only get the default message "The requested URL
> /_force_404_ was not found on this server."
>
That's backwards. You can use R=404 in the flags of a rewriterule.
> Regards,
> Dennis
>
> On 11/05/2010 03:31 AM, Igor Cicimov wrote:
>>
>> Post the rewrite rule here.
>>
>> Igor
>>
>>> On Nov 5, 2010 1:11 PM, "Dennis Jacobfeuerborn" <dennisml@conversis.de
>>> <ma...@conversis.de>> wrote:
>>>
>>> Hi,
>>> I'm trying to find a way to always generate a 404 error using htaccess
>>> when a directory is accessed and with mod_autoindex enabled.
>>> That is when I access http://server/directory/ I want to get a 404 error
>>> instead of an auto generated index.
>>>
>>> I tried doing this with a RewriteRule but the autogenerated index gets
>>> displayed anyway and disabling the Index with "Options -Indexes" only
>>> gives me a 403 instead of a 404.
>>>
>>> Is there a way to do this?
>>>
>>> Regards,
>>> Dennis
>>>
>>> ---------------------------------------------------------------------
>>> The official User-To-User support forum of the Apache HTTP Server
>>> Project.
>>> See <URL:http://httpd.apache.org/userslist.html> for more info.
>>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>>> <ma...@httpd.apache.org>
>>> " from the digest: users-digest-unsubscribe@httpd.apache.org
>>> <ma...@httpd.apache.org>
>>> For additional commands, e-mail: users-help@httpd.apache.org
>>> <ma...@httpd.apache.org>
>>>
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> " from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
--
Eric Covener
covener@gmail.com
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Forcing custom 404 error page instead of autoindex
Posted by Dennis Jacobfeuerborn <de...@conversis.de>.
ErrorDocument 404 /_disabled/index.html
RewriteEngine on
RewriteRule !/_disabled/ /_force_404_
The idea was to use the rewrite rule to rewrite any access to a
non-existing page and then have the ErrorDocument directive catch that but
instead of a custom error page I only get the default message "The
requested URL /_force_404_ was not found on this server."
Regards,
Dennis
On 11/05/2010 03:31 AM, Igor Cicimov wrote:
> Post the rewrite rule here.
>
> Igor
>
>> On Nov 5, 2010 1:11 PM, "Dennis Jacobfeuerborn" <dennisml@conversis.de
>> <ma...@conversis.de>> wrote:
>>
>> Hi,
>> I'm trying to find a way to always generate a 404 error using htaccess
>> when a directory is accessed and with mod_autoindex enabled.
>> That is when I access http://server/directory/ I want to get a 404 error
>> instead of an auto generated index.
>>
>> I tried doing this with a RewriteRule but the autogenerated index gets
>> displayed anyway and disabling the Index with "Options -Indexes" only
>> gives me a 403 instead of a 404.
>>
>> Is there a way to do this?
>>
>> Regards,
>> Dennis
>>
>> ---------------------------------------------------------------------
>> The official User-To-User support forum of the Apache HTTP Server Project.
>> See <URL:http://httpd.apache.org/userslist.html> for more info.
>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>> <ma...@httpd.apache.org>
>> " from the digest: users-digest-unsubscribe@httpd.apache.org
>> <ma...@httpd.apache.org>
>> For additional commands, e-mail: users-help@httpd.apache.org
>> <ma...@httpd.apache.org>
>>
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Forcing custom 404 error page instead of autoindex
Posted by Igor Cicimov <ic...@gmail.com>.
Post the rewrite rule here.
Igor
On Nov 5, 2010 1:11 PM, "Dennis Jacobfeuerborn" <de...@conversis.de>
wrote:
Hi,
I'm trying to find a way to always generate a 404 error using htaccess when
a directory is accessed and with mod_autoindex enabled.
That is when I access http://server/directory/ I want to get a 404 error
instead of an auto generated index.
I tried doing this with a RewriteRule but the autogenerated index gets
displayed anyway and disabling the Index with "Options -Indexes" only gives
me a 403 instead of a 404.
Is there a way to do this?
Regards,
Dennis
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org