2012-04-17 31 views
70

Tôi có một tập tin htaccess rằng nó hoạt động hoàn hảo trên máy chủ nhưng khi tôi đặt nó trên địa phương, nó cho thấy tôi lỗi này:Internal Server Error - 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.

tôi thấy cảnh báo này trong log file lỗi:

[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

này là mã tập tin htaccess của tôi:

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> 

máy chủ địa phương của tôi chạy bởi wamp và tôi kích hoạt viết lại mô-đun quá! !!

vì vậy, điều gì sẽ xảy ra? !!

+0

câu trả lời tốt nhất [ở đây] (http://www.steptoinstall.com/wamp-500-internal-server-error-htaccess-php-codeigniter.html) –

Trả lời

98

chỉ thị Header nằm trong mô-đun apache mod_headers. Bạn cần đảm bảo rằng mô-đun được tải vào máy chủ apache.

+6

Cảm ơn ... nó được đặt tên như headers_module trong danh sách mô-đun :) –

+2

Đối với lười biếng chỉ cần làm: ... AntonioCS

9

Hãy thử điều này:

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

Bạn đã khởi động lại sau khi cài đặt WAMP/cho phép?

61

bước để cho phép ĐẦU module

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

Điều này có thể là một lót: 'sudo a2enmod tiêu đề && sudo service apache2 restart' (nên làm việc trên các bản phân phối dựa trên Debian). –

5

Trong một máy Ubuntu/Debian bạn chỉ có thể chạy lệnh này:

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

và phải được tất cả bộ .....

27

Trên dòng lệnh của bạn:

Cài đặt mod_headers

sudo a2enmod headers 

và sau đó khởi động lại apache

service apache2 restart 
+0

điều này làm việc cho tôi! cảm ơn – spacebiker

Các vấn đề liên quan