2012-04-17 13 views
70

私はそれがホスト上で完璧に動作することのhtaccessファイルを持っているが、私は地元の上に置くとき、それはこのエラーを私に示しています内部サーバーエラー - htaccessの

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

私は、エラー・ログ・ファイルにこのアラートを見つけました:

[Tue Apr 17 10:02:25 2012] [alert] [client 127.0.0.1] D:/wamp/www/jivan/sql/.htaccess: Invalid command 'Header', perhaps misspelled or defined by a module not included in the server configuration

これは私のhtaccessファイルのコードです:

RewriteEngine On 
AddDefaultCharset utf-8 
RewriteRule ^([0-9-]+)/keyword_show.html$ keyword_show.php?keyword_id=$1 
RewriteRule ^page_(.*).html$ page.php?url=$1 
RewriteRule ^([0-9-]+)/(.*)/(.*)/(.*).html$ $2.php?advertisement_cat=$1&id=$3&pagenumber=$4 
RewriteRule ^([0-9-]+)/(.*)/(.*).html$ $2.php?advertisement_cat=$1&pagenumber=$3 
RewriteRule ^([0-9-]+)/(.*).html$ $2.php?advertisement_cat=$1 
# cache images and flash content for one month 
<FilesMatch ".(flv|gif|jpg|jpeg|png|ico|swf)$"> 
Header set Cache-Control "max-age=2592000" 
</FilesMatch> 

# cache text, css, and javascript files for one month 
<FilesMatch ".(js|css|pdf|txt)$"> 
Header set Cache-Control "max-age=2592000" 
</FilesMatch> 

私のローカルサーバーがWAMPによって実行され、私も書き換えモジュールを有効に! !!

だから何が問題なのですか?

+0

最良の答えを再起動します –

答えて

98

Headerディレクティブはmod_headers apacheモジュールにあります。モジュールがapacheサーバーにロードされていることを確認する必要があります。

+6

ありがとう...それはモジュールリストのheaders_moduleとして名前が付けられています:) –

+2

怠け者のためだけに: ... AntonioCS

9

はこれを試してみてください:

<IfModule mod_headers.c> Header set [your_options] </IfModule> 

あなたが有効/インストール後にWAMPを再起動することがありますか?あなたは、単にこのコマンドを実行することができますUbuntuの/ Debianのマシンでは

$ cd /etc/apache2/mods-available 
$ sudo a2enmod headers 
$ /etc/init.d/apache2 restart 
61

ステップ:

sudo ln -s /etc/apache2/mods-available/headers.load /etc/apache2/mods-enabled/ 

を、すべて設定する必要があります.....

+5

これは1ライナーです: 'sudo a2enmod headers && sudo service apache2 restart' Debianベースのディストリビューションで動作するはずです)。 –

5

をHEADERSモジュールを有効にする

27

あなたのコマンドラインで:

インストールmod_headers

sudo a2enmod headers 

し、[ここ](http://www.steptoinstall.com/wamp-500-internal-server-error-htaccess-php-codeigniter.html)apacheの

service apache2 restart 
+0

これは私のために働いた!ありがとう – spacebiker