errorseiten konfigurieren



  • hallo zusammen,
    habe bei mir auf dem rechner apache installiert und nun wollte ich die ganze sache noch etwas optimieren.
    leider habe ich bisher nirgends gefunden wo meine eigenen errorseiten angeben kann ( zum beispiel bei fehler 404 oder so... ).
    ausserdem wollte ich folgendes:
    angenommen in meinem ordner existiert keine index.html oder index.php wird die gesamte übersicht des ordners im explorer angezeigt.
    dies möchte ich aber unterbinden ( hab da mal gehört, das dies über die apachekonfiguration möglich ist ( natürlich auch über die rechtevergabe der ordner, so möchte ich das aber nicht machen) ).
    ok, dass solls dann erst einmal gewesen sein.
    schön tag noch 🙂



  • gast99 schrieb:

    hallo zusammen,
    habe bei mir auf dem rechner apache installiert und nun wollte ich die ganze sache noch etwas optimieren.
    leider habe ich bisher nirgends gefunden wo meine eigenen errorseiten angeben kann ( zum beispiel bei fehler 404 oder so... ).

    Das kann mit der "ErrorDocument" Anweisung geändert werden.

    http://httpd.apache.org/docs/mod/core.html#errordocument
    http://httpd.apache.org/docs-2.0/mod/core.html#errordocument

    ErrorDocument Directive

    Description: What the server will return to the client in case of an error
    Syntax: ErrorDocument error-code document
    Context: server config, virtual host, directory, .htaccess
    Override: FileInfo
    Status: Core
    Module: core
    Compatibility: Quoting syntax for text messages is different in Apache 2.0

    In the event of a problem or error, Apache can be configured to do one of four things,

    1. output a simple hardcoded error message
    2. output a customized message
    3. redirect to a local URL-path to handle the problem/error
    4. redirect to an external URL to handle the problem/error

    The first option is the default, while options 2-4 are configured using the ErrorDocument directive, which is followed by the HTTP response code and a URL or a message. Apache will sometimes offer additional information regarding the problem/error.

    URLs can begin with a slash (/) for local URLs, or be a full URL which the client can resolve. Alternatively, a message can be provided to be displayed by the browser. Examples:

    ErrorDocument 500 http://foo.example.com/cgi-bin/tester
    ErrorDocument 404 /cgi-bin/bad_urls.pl
    ErrorDocument 401 /subscription_info.html
    ErrorDocument 403 "Sorry can't allow you access today"
    

    gast99 schrieb:

    ausserdem wollte ich folgendes:
    angenommen in meinem ordner existiert keine index.html oder index.php wird die gesamte übersicht des ordners im explorer angezeigt.
    dies möchte ich aber unterbinden ( hab da mal gehört, das dies über die apachekonfiguration möglich ist ( natürlich auch über die rechtevergabe der ordner, so möchte ich das aber nicht machen) ).
    ok, dass solls dann erst einmal gewesen sein.
    schön tag noch 🙂

    Das kann mit "Options +/-Indexes" gesteuert werden.

    http://httpd.apache.org/docs/mod/core.html#options
    http://httpd.apache.org/docs-2.0/mod/core.html#options

    Options Directive

    Description: Configures what features are available in a particular directory
    Syntax: Options [+|-]option [[+|-]option] ...
    Default: Options All
    Context: server config, virtual host, directory, .htaccess
    Override: Options
    Status: Core
    Module: core

    The Options directive controls which server features are available in a particular directory.

    option can be set to None, in which case none of the extra features are enabled, or one or more of the following:

    All
    All options except for MultiViews. This is the default setting.
    ...
    Indexes
    If a URL which maps to a directory is requested, and there is no DirectoryIndex (e.g., index.html) in that directory, then mod_autoindex will return a formatted listing of the directory.
    ...



  • danke für deine hilfe !


Anmelden zum Antworten