2013-05-26 18 views
6

Ho letto da un po 'e non riesco a farlo funzionare.Mod_rewrite è abilitato ma non funziona

mod_rewrite è abilitato in Apache e ho cambiato AllowOverride a tutti

mio .htaccess si presenta così:

Options +FollowSymLinks 
RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.+)$ profile.php/?username=$1 [L] 

e il mio file predefinito per apache2 assomiglia a questo: ServerAdmin webmaster @ localhost

DocumentRoot /var/www 
    <Directory /> 
      Options FollowSymLinks 
      AllowOverride all 
    </Directory> 
    <Directory /var/www/> 
      Options Indexes FollowSymLinks MultiViews 
      AllowOverride all 
      Order allow,deny 
      allow from all 
    </Directory> 

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ 
    <Directory "/usr/lib/cgi-bin"> 
      AllowOverride None 
      Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch 
      Order allow,deny 
      Allow from all 
    </Directory> 

    ErrorLog ${APACHE_LOG_DIR}/error.log 

    # Possible values include: debug, info, notice, warn, error, crit, 
    # alert, emerg. 
    LogLevel warn 

    CustomLog ${APACHE_LOG_DIR}/access.log combined 

.515.053.691,36321 milioni

Error.log

[Sat May 25 20:13:21 2013] [alert] [client (ip)] /var/www/.htaccess: Invalid command '\xef\xbb\xbfRewriteEngine', perhaps misspelled or defined by$ 
[Sat May 25 20:13:21 2013] [alert] [client (ip)] /var/www/.htaccess: Invalid command '\xef\xbb\xbfRewriteEngine', perhaps misspelled or defined by$ 
[Sat May 25 20:13:22 2013] [alert] [client (ip)] /var/www/.htaccess: Invalid command '\xef\xbb\xbfRewriteEngine', perhaps misspelled or defined by$ 
[Sat May 25 20:13:23 2013] [alert] [client (ip)] /var/www/.htaccess: Invalid command '\xef\xbb\xbfRewriteEngine', perhaps misspelled or defined by$ 
[Sat May 25 20:14:56 2013] [alert] [client (ip)] /var/www/.htaccess: Invalid command '\xef\xbb\xbf', perhaps misspelled or defined by a module not$ 
[Sat May 25 20:14:57 2013] [alert] [client (ip)] /var/www/.htaccess: Invalid command '\xef\xbb\xbf', perhaps misspelled or defined by a module not$ 
[Sat May 25 20:14:59 2013] [alert] [client (ip)] /var/www/.htaccess: Invalid command '\xef\xbb\xbf', perhaps misspelled or defined by a module not$ 
[Sat May 25 20:14:59 2013] [alert] [client (ip)] /var/www/.htaccess: Invalid command '\xef\xbb\xbf', perhaps misspelled or defined by a module not$ 
[Sat May 25 20:15:04 2013] [alert] [client (ip)] /var/www/.htaccess: Invalid command '\xef\xbb\xbfRewriteEngine', perhaps misspelled or defined by$ 
[Sat May 25 20:15:04 2013] [alert] [client (ip)] /var/www/.htaccess: Invalid command '\xef\xbb\xbfRewriteEngine', perhaps misspelled or defined by$ 
[Sat May 25 20:15:20 2013] [alert] [client (ip)] /var/www/.htaccess: Invalid command '\xef\xbb\xbfRewriteEngine', perhaps misspelled or defined by$ 
[Sat May 25 20:15:20 2013] [alert] [client (ip)] /var/www/.htaccess: Invalid command '\xef\xbb\xbfRewriteEngine', perhaps misspelled or defined by$ 
[Sat May 25 20:15:58 2013] [notice] caught SIGTERM, shutting down 

Sul mio sito ricevo un messaggio di errore 500 del server interno. Per favore aiuto!

+1

_ "Sul mio sito Web ricevo un messaggio di errore del server interno 500" _ - quindi controlla i log degli errori del server! – CBroe

+0

Appena aggiunto error.log, andando ad aggiungere access.log anche se mostra qualcosa. – TheMeisterSE

+0

Come già detto da anubhava, sembra che il tuo file sia un po 'incasinato - '\ xef \ xbb \ xbf', che sembra essere un Byte Order Mark. Se apache si lamenta di ciò nella seconda riga del file, sembra che tu abbia modificato un file con codifica UTF-8 con un editor che non lo gestisce correttamente mentre aggiunge la prima riga o qualcosa del genere. _Tipo_ (non copia e incolla) quelle righe in un nuovo file di nuovo, e salvalo come semplice ASCII - che dovrebbe risolvere questo problema. – CBroe

risposta

2

provare a cambiare il codice per questo:

Options +FollowSymLinks -MultiViews 
# Turn mod_rewrite on 
RewriteEngine On 
RewriteBase/

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.+)$ profile.php/?username=$1 [L] 

cioè girare le opzioni MultiViews off.

PS: Guardando il tuo error.log sembra che tu abbia alcuni caratteri speciali nel tuo .htaccess prima della parola chiave RewriteEngine.

Problemi correlati