You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Christian Zietz <cz...@gmx.net> on 2004/03/08 20:22:59 UTC

[users@httpd] exclude subdirectories from .htaccess / disable custom ErrorDocument

Hi,

let me first describe my configuration: I've got a directory with a
custom 404 ErrorDocument defined by .htaccess. This obviously works for
all subdirectories. But in a specific subdirectory I would like the
hard-coded standard error message instead.

So is there a way to
- exclude a subdirectory from the present .htaccess file
- or to re-enable the hard-coded messages in the subdirectory?

Currently I wrote a neutral ErrorDocument for the subdirectory but I
would rather like to see the hard-coded message.

Christian



---------------------------------------------------------------------
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] exclude subdirectories from .htaccess / disable custom ErrorDocument

Posted by Joshua Slive <jo...@slive.ca>.
Christian Zietz wrote:

> Let me explain some more. I'm changing the structure of my web site. All
> the files used to be in the root directory of the server
> (http://.../file.html).
> Now I'm moving them to subdirectories and I configured a custom error
> message for the root directory (basically saying: "Site structure has
> changed. You'll be redirected to the index page.") Of course if a file
> isn't found in the subdirectories it is not because of the changed
> structure but because it's not there. At the moment I have custom error
> messages (saying approximately: "That file is really not there.")
> But I like the hard-coded messages.

Yes, but you didn't explain *why* you like the hard-coded message.  They 
are really pretty pointless.  If you are using 2.0, then it comes with a 
set of custom error messages that you can easily use.

But in any case, my proposed solution will work fine for you.  You just 
put the new directory outside the DocumentRoot and Alias it into the 
webspace.

Joshua.

---------------------------------------------------------------------
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] exclude subdirectories from .htaccess / disable custom ErrorDocument

Posted by Christian Zietz <cz...@gmx.net>.
Hi,

Joshua Slive schrieb:

> Christian Zietz wrote:
>> So is there a way to
>> - exclude a subdirectory from the present .htaccess file
>> - or to re-enable the hard-coded messages in the subdirectory?

> Sound's like a security-through-obscurity type of request, which are 
> usually pointless.

Let me explain some more. I'm changing the structure of my web site. All
the files used to be in the root directory of the server
(http://.../file.html).
Now I'm moving them to subdirectories and I configured a custom error
message for the root directory (basically saying: "Site structure has
changed. You'll be redirected to the index page.") Of course if a file
isn't found in the subdirectories it is not because of the changed
structure but because it's not there. At the moment I have custom error
messages (saying approximately: "That file is really not there.")
But I like the hard-coded messages.

CU Christian


---------------------------------------------------------------------
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] exclude subdirectories from .htaccess / disable custom ErrorDocument

Posted by Joshua Slive <jo...@slive.ca>.
Christian Zietz wrote:
> let me first describe my configuration: I've got a directory with a
> custom 404 ErrorDocument defined by .htaccess. This obviously works for
> all subdirectories. But in a specific subdirectory I would like the
> hard-coded standard error message instead.
> 
> So is there a way to
> - exclude a subdirectory from the present .htaccess file
> - or to re-enable the hard-coded messages in the subdirectory?
> 
> Currently I wrote a neutral ErrorDocument for the subdirectory but I
> would rather like to see the hard-coded message.

Sound's like a security-through-obscurity type of request, which are 
usually pointless.  I'd just do
ErrorDocument 404 "Woops.  Not found."

But if you really want to do this, you could move the subdirectory to a 
different place in the filesystem and Alias it over to where you want 
it.  Something like

<Directory /usr/local/apache/htdocs/specialerror>
ErrorDocument 404 /error/special.html
</Directory>
Alias /specialerror/notspecial /usr/local/apache/htdocs/notspecial
<Directory /usr/local/apache/htdocs/notspecial>
# Whatever config you want; Doesn't inherit from /specialerror
</Directory>

This would look exactly the same from the web, but would allow 
"/specialerror/notspecial" not to inherit the config fril /specialerror.

Joshua.

---------------------------------------------------------------------
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