Drupal 6.2 Erstinstallation -> "400 Bad Request" - Ursache "RewriteEngine on"
am 06.07.2008 - 19:44 Uhr in
Meine Drupalinstallation liess sich nicht starten,
also habe ich nacheinander jeden einzelnen Punkt der
Drupal-Default .htaccess auskommentiert,
und so den Fehler gefunden:
"400 Bad Request" - Fehler beim Aufruf:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>Alles Funktioniert:
<IfModule mod_rewrite.c>
# RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>Die Ursache liegt also beim Modul mod_rewrite, das Modul ist jedoch geladen,
phpinfo meldet:
Loaded Modules:
core mod_log_config mod_logio prefork http_core mod_so mod_alias mod_auth_basic mod_auth_digest mod_authn_file mod_authz_default mod_authz_groupfile mod_authz_host mod_authz_user mod_autoindex mod_cgi mod_dir mod_env mod_expires mod_mime mod_negotiation mod_php5 mod_rewrite mod_setenvif mod_ssl mod_status
auch apache2ctl bestätigt das:
USER@SHELL# apache2ctl -M
Loaded Modules:
core_module (static)
log_config_module (static)
logio_module (static)
mpm_prefork_module (static)
http_module (static)
so_module (static)
alias_module (shared)
auth_basic_module (shared)
auth_digest_module (shared)
authn_file_module (shared)
authz_default_module (shared)
authz_groupfile_module (shared)
authz_host_module (shared)
authz_user_module (shared)
autoindex_module (shared)
cgi_module (shared)
dir_module (shared)
env_module (shared)
expires_module (shared)
mime_module (shared)
negotiation_module (shared)
php5_module (shared)
rewrite_module (shared)
setenvif_module (shared)
ssl_module (shared)
status_module (shared)
Syntax OK
USER@SHELL#Da ich gern Clean URLs benutzen möchte,
benötige ich ein funktionierendes mod_rewrite,
wenn ich aber RewriteEngine on aktiviere,
läuft die komplette Site auf einen Fehler.
Wer weiss Rat?
Apache/2.2.3 (Debian) PHP/5.2.0-8+etch11
- Anmelden oder Registrieren um Kommentare zu schreiben

httpd.conf braucht eine weitere Konfigurationsanweisung
am 06.07.2008 - 21:27 Uhr
Allein das Laden des Modules mod_rewrite reicht nicht.
Die httpd.conf braucht eine weitere Konfigurationsanweisung um mod_rewrite auch verfuegbar zu machen. Soll heissen das die Verwendung von Anweisungen in der .htaccess erlaubt wird.
Aber das hast Du vermutlich per google schon selbst rausgefunden.
PS
Zauberwort: AllowOveride
-------------
quiptime
Nur tote Fische schwimmen mit dem Strom.
Die Voreinstellung der
am 06.07.2008 - 23:52 Uhr
Die Voreinstellung der Direktive AllowOverride ist "AllowOverride All",
ich bin davon ausgegangen, daß Sie damit nur erforderlich ist, wenn
man AllowOverride explizit ausschalten will ("AllowOverride None").
Ich habe es aber dennoch probiert und folgende Zeilen in das
Konfigurationsfile des Virtuellen Hostes,
und danach auch in httpd.conf eingetragen:
<Directory "/pfad/zur/drupal/wurzel/">AllowOverride All
</Directory>
Leider ohne Erfolg, mein Problem besteht weiterhin.
Mit der Standardmaessigen
am 07.07.2008 - 00:52 Uhr
Mit der Standardmaessigen Einstellung von AllowOverride hast Du recht.
Neulich ist es mir bei einem Server trotzdem erst nach explizitem Eintragen dieser Direktive gelungen die Clean URL's zu verwenden.
Kannst Du mal eine frische Drupal .htaccess hochladen?
Alle Pfade stimmen (/pfad/zur/drupal/wurzel/) ?
-------------
quiptime
Nur tote Fische schwimmen mit dem Strom.
Der Pfad stimmt, ich habe
am 07.07.2008 - 01:24 Uhr
Der Pfad stimmt, ich habe Ihn kopiert, nicht nachgetippt.
Die .htaccess ist die neueste, habe gerade erst die
deutschsprachige Version 6.2 erstmalig installiert.
Drupal wurde nicht in ein Subdirectory installiert.
Hier die .htaccess, die mit Drupal kommt:
#
# Apache/PHP/Drupal settings:
#
# Protect files and directories from prying eyes.
<FilesMatch "\.(engine|inc|info|install|module|profile|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(code-style\.pl|Entries.*|Repository|Root|Tag|Template)$">
Order allow,deny
</FilesMatch>
# Don't show directory listings for URLs which map to a directory.
Options -Indexes
# Follow symbolic links in this directory.
Options +FollowSymLinks
# Customized error messages.
ErrorDocument 404 /index.php
# Set the default handler.
DirectoryIndex index.php
# Override PHP settings. More in sites/default/settings.php
# but the following cannot be changed at runtime.
# PHP 4, Apache 1.
<IfModule mod_php4.c>
php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0
php_value mbstring.http_input pass
php_value mbstring.http_output pass
php_value mbstring.encoding_translation 0
</IfModule>
# PHP 4, Apache 2.
<IfModule sapi_apache2.c>
php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0
php_value mbstring.http_input pass
php_value mbstring.http_output pass
php_value mbstring.encoding_translation 0
</IfModule>
# PHP 5, Apache 1 and 2.
<IfModule mod_php5.c>
php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0
php_value mbstring.http_input pass
php_value mbstring.http_output pass
php_value mbstring.encoding_translation 0
</IfModule>
# Requires mod_expires to be enabled.
<IfModule mod_expires.c>
# Enable expirations.
ExpiresActive On
# Cache all files for 2 weeks after access (A).
ExpiresDefault A1209600
# Do not cache dynamically generated pages.
ExpiresByType text/html A1
</IfModule>
# Various rewrite rules.
<IfModule mod_rewrite.c>
RewriteEngine on
# If your site can be accessed both with and without the 'www.' prefix, you
# can use one of the following settings to redirect users to your preferred
# URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
#
# To redirect all users to access the site WITH the 'www.' prefix,
# (http://example.com/... will be redirected to http://www.example.com/...)
# adapt and uncomment the following:
# RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
# RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
#
# To redirect all users to access the site WITHOUT the 'www.' prefix,
# (http://www.example.com/... will be redirected to http://example.com/...)
# uncomment and adapt the following:
# RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
# RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]
# Modify the RewriteBase if you are using Drupal in a subdirectory or in a
# VirtualDocumentRoot and the rewrite rules are not working properly.
# For example if your site is at http://example.com/drupal uncomment and
# modify the following line:
# RewriteBase /drupal
#
# If your site is running in a VirtualDocumentRoot at http://example.com/,
# uncomment the following line:
# RewriteBase /
# Rewrite URLs of the form 'index.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>
# $Id: .htaccess,v 1.90 2007/10/05 14:43:23 dries Exp $
Hast Du nach einer Aenderung
am 07.07.2008 - 10:03 Uhr
Hast Du nach einer Aenderung der Apachekonfiguration mal den Apache neu gestartet?
-------------
quiptime
Nur tote Fische schwimmen mit dem Strom.
Ja, nach jeder Änderung der
am 07.07.2008 - 10:12 Uhr
Ja, nach jeder Änderung der Konfiguration starte ich den Server neu:
root@host:~# /etc/init.d/apache2 restartGibt es eine Meldung im
am 07.07.2008 - 10:40 Uhr
Gibt es eine Meldung im Apache error.log?
Bist Du Dir sicher die
am 07.07.2008 - 12:05 Uhr
Bist Du Dir sicher die richtige Apache Konfigurationsdatei zu bearbeiten?
-------------
quiptime
Nur tote Fische schwimmen mit dem Strom.
Eine alternative .htaccess zum Testen
am 07.07.2008 - 15:24 Uhr
Eine alternative .htaccess zum Testen: Gut lesbare URL - mod rewrite - SEO
-------------
quiptime
Nur tote Fische schwimmen mit dem Strom.
Danke für den Link, die
am 08.07.2008 - 01:28 Uhr
Danke für den Link, die Lösung liegt
tatsächlich irgendwo in der .htaccess Datei auf der Seite,
aber eins nach dem anderen:
1. Ich habe die .htaccess von der Site 1:1 übernommen,
Ergebnis: Der Browser meldet "500 Internal Server Error", das error.log sagt:
[Tue Jul 08 01:44:07 2008] [alert] [client 12.34.56.78] /path/to/drupal/root/.htaccess: Option Indexes not allowed here2. Option Indexes auskommentiert, weiterer Versuch,
Ergebnis: Der Browser meldet "500 Internal Server Error", das error.log sagt nun:
[Tue Jul 08 01:46:32 2008] [alert] [client 12.34.56.78] /path/to/drupal/root/.htaccess: Option FollowSymLinks not allowed here3. Option FollowSymLinks auskommentiert, weiterer Versuch,
Ergebnis "Sie haben keine Berechtigung"
4. Ich entferne noch den Eintrag "Order allow,deny" und siehe da,
Alles funktioniert, RewriteEngine ist on und der Eintrag
"Lesbare URLs" lässt sich in den Einstellungen aktivieren!
Welcher Eintrag nun genau dafür sorgt, das es nun geht,
werde ich später herausfinden, jetzt muss ich erstmal eine Mütze Schlaf nehmen.
Vielen Dank an quiptime!
:-))
am 08.07.2008 - 11:30 Uhr
:-))
-------------
quiptime
Nur tote Fische schwimmen mit dem Strom.