Hallo zusammen,
bei mir wird der Inhalt meiner Seite mit dem Seitentyp "404 Seite nicht gefunden" (Beim Aufruf einer nicht vorhandenen Seite wird stattdessen die 404-Fehlerseite geladen) nicht angezeigt. Stattdessen wird die Meldung "Page not found" ausgegeben. Ich nehme an, dass es sich bei "Page not found" um eine Contao-Meldung handelt. Warum wird diese Meldung ausgegeben und nicht die 404-Seite aufgerufen???
Meine 404-Seite hat den Alias 404. Wenn ich 404.html direkt aufrufe erhalte ich ebenfalls "Page not found". Ändere ich den Seitentyp auf "Reguläre Seite" (Eine reguläre Seite enthält Artikel und Inhaltselemente. Sie verhält sich wie eine statische HTML-Seite.) kann ich diese über 404.html direkt aufrufen. Im Frontend ist es mir also nicht möglich die 404.html aufzurufen, wenn diese den Seitentyp "404 Seite nicht gefunden" hat.
Wenn ich eine andere, nicht vorhandene Seite *.html in die URL-Zeile eingebe (z.B. www.meinedomain.de/test.html - wobei es die Seite Test nicht gibt) erhalte ich ebenfalls die Meldung "Page not found".
Wenn ich eine andere, nicht vorhandene Seite *htm in die URL-Zeile eingebe (also test.htm) erhalte ich eine Apache-Server-Meldung:
Not found - The requested URL /test.htm was not found on this server.
Ich nutze Contao 2.10.1. Die Seite und der dazugehörige Artikel sind veröffentlicht. Mein Provider ist Alfahosting (Profipaket). Das Problem konnte ich aber auch mit XAMPP lokal nachvollziehen.
Die Einstellung "URLs umschreiben" ist aktiv und auch die .htaccess ist entsprechend angepasst (siehe unten - die komplette Seite läuft eigentlich schon. Nur die 404 wollte ich noch eben hinzufügen...). Wenn ich in der .htaccess unten "ErrorDocument 404 /404.html" hinzufüge, erhalte ich auch für test.htm die Meldung "Page not found".
Für Hinweise die zur Lösung des Problems führen, wäre ich echt dankbar!
Viele Grüße
Uwe
Inhalt der .htaccess
Code:
##
# Disable ETags
# @see http://developer.yahoo.com/performance/rules.html#etags
##
FileETag None
##
# Prevent access to the Contao template files
##
<FilesMatch "\.(tpl|html5|xhtml)$">
Order allow,deny
Deny from all
</FilesMatch>
<IfModule mod_mime.c>
##
# Serve the correct content type for .htc files (CSS3 PIE)
# @see http://css3pie.com/documentation/kno.../#content-type
##
AddType text/x-component .htc
</IfModule>
<IfModule mod_deflate.c>
##
# Use mod_deflate to compress JavaScript, CSS, XML, HTML and PHP files.
# @see http://developer.yahoo.com/performance/rules.html#gzip
##
<FilesMatch "\.(css|js|xml|html?|php)$">
SetOutputFilter DEFLATE
</FilesMatch>
</IfModule>
<IfModule mod_headers.c>
##
# Disable ETags
# @see http://developer.yahoo.com/performance/rules.html#etags
##
Header unset ETag
##
# Add a Vary Accept-Encoding header for the compressed resources. If you
# modify the file types above, make sure to change them here accordingly.
# @see http://developer.yahoo.com/performance/rules.html#gzip
##
<FilesMatch "\.(js|css|xml|gz)$">
Header append Vary Accept-Encoding
</FilesMatch>
</IfModule>
<IfModule mod_expires.c>
##
# Activate the module
##
ExpiresActive On
##
# Specify an expiration 30 days in the future for images, JavaScripts and
# CSS files. Edit or remove the lines to set up your own expiration logic.
# @see http://developer.yahoo.com/performan...s.html#expires
##
ExpiresByType image/png A2592000
ExpiresByType image/gif A2592000
ExpiresByType image/jpg A2592000
ExpiresByType image/jpeg A2592000
ExpiresByType text/javascript A2592000
ExpiresByType application/x-javascript A2592000
ExpiresByType application/javascript A2592000
ExpiresByType text/css A2592000
</IfModule>
<IfModule mod_rewrite.c>
##
# Activate the module
##
RewriteEngine On
##
# Set the RewriteBase if your Contao installation is in a subdirectoy and
# the rewrite rules are not working properly. Usage examples:
#
# RewriteBase /contao-2.9.0
# RewriteBase /path/to/contao
#
# Uncomment the following line to set the RewriteBase.
##
RewriteBase /
##
# Contao usually does not pass absolute URLs via GET, therefore the
# following rules block all requests that try to pass a URL or the /etc/
# directory as parameter (malicious requests).
##
RewriteCond %{REQUEST_URI} (ftp|https?):|/etc/ [NC,OR]
RewriteCond %{QUERY_STRING} (ftp|https?):|/etc/ [NC]
RewriteRule .* - [F,L]
##
# Uncomment the following lines and replace "domain.com" with your domain
# name to redirect requests without "www" to the correct domain.
##
#RewriteCond %{HTTP_HOST} ^domain\.com [NC]
#RewriteRule (.*) http://www.domain.com/$1 [R=301,L]
##
# If you cannot use mod_deflate, uncomment the following lines to load a
# compressed .gz version of the bigger Contao JavaScript and CSS files.
##
#AddEncoding gzip .gz
#<FilesMatch "\.js\.gz$">
# AddType "text/javascript" .gz
#</FilesMatch>
#<FilesMatch "\.css\.gz$">
# AddType "text/css" .gz
#</FilesMatch>
#RewriteCond %{HTTP:Accept-encoding} gzip
#RewriteCond %{REQUEST_FILENAME} \.(js|css)$
#RewriteCond %{REQUEST_FILENAME}.gz -f
#RewriteRule ^(.*)$ $1.gz [QSA,L]
##
# Do not rewrite requests for static files or folders such as style sheets,
# images, movies or text documents.
##
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
##
# By default, Contao adds ".html" to the generated URLs to simulate static
# HTML documents. If you change the URL suffix in the back end settings, make
# sure to change it here accordingly!
#
# RewriteRule .*\.html$ index.php [L] # URL suffix .html
# RewriteRule .* index.php [L] # No URL suffix
# RewriteRule .*\.txt$ index.php [L] # URL suffix .txt
#
# If you are using mod_cache, it is recommended to use the RewriteRule below,
# which adds the query string to the internal URL:
#
# RewriteRule (.*\.html)$ index.php/$1 [L]
#
# Note that not all environments support mod_rewrite and mod_cache.
##
RewriteRule .*\.html$ index.php [L]
</IfModule>
Lesezeichen