【发布时间】:2015-11-09 14:26:21
【问题描述】:
我下载了一个网站项目,目的是在本地复制网站并在本地使用它,直到我完成项目,然后将其发送回托管服务。
我下载了网站文件夹并将其添加到 Wamp 中的 www 文件夹中。 Wamp 工作正常,(测试指数样本)。我导出了数据库并将它们导入到本地的 phpMyAdmin。然后我创建了用户/密码以从网站访问数据库。我将所有权限分配给该用户。
我的网站结构是 www/html/system。我有一个重定向到系统文件夹的 .htaccess。重定向工作正常。在系统文件夹中,我有另一个 .htaccess 文件,如下所示。
在我网站的 .htaccess 文件中,我有:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html
#AddType x-mapp-php5 .php
#AddHandler x-mapp-php5 .php
#AddHandler application/x-httpd-php52 .php .php5 .php4 .php3
#<IfModule mod_suphp.c>
# AddHandler application/x-httpd-php-5 .php
#</IfModule>
#Error Document
ErrorDocument 400 http://www.example.com/error400.html
ErrorDocument 403 http://www.example.com/error403.html
ErrorDocument 404 http://www.example.com/error404.html
ErrorDocument 500 http://www.example.com/error500.html
#FileETag none
#expires after one month
<FilesMatch "^(_images/new_logo.png|_images/default-player.png|_images/default-team.png|storage/events/1/event01.jpg|_images/help.png|_images/bigpicture_regular.png|_images/facebook.png|_images/twitter.png|_images/default_member_pic.gif|_images/feedback.png|storage/events/2/event01.jpg|_images/dot.png|_buttons/home.png|_buttons/media_forward.png|_buttons/print.png|_jquery/jquery-ui.js|_jquery/jScrollbar.jquery.css|_jquery/jquery.js|_jquery/jScrollbar.jquery.js|_jquery/jquery-mousewheel.js|_fancybox/jquery-1.4.3.min.js|_fancybox/ajax.txt|_fancybox/fancybox/jquery.mousewheel-3.0.4.pack.js|_fancybox/fancybox/jquery.fancybox-1.3.4.pack.js|_fancybox/fancybox/jquery.fancybox-1.3.4.js|_fancybox/fancybox/jquery.fancybox-1.3.4.css|_fancybox/fancybox/jquery.easing-1.3.pack.js|_fancybox/fancybox/fancybox.png|_fancybox/fancybox/fancybox-y.png|_fancybox/fancybox/fancybox-x.png|_fancybox/fancybox/fancy_title_right.png|_fancybox/fancybox/fancy_title_over.png|_fancybox/fancybox/fancy_title_main.png|_fancybox/fancybox/fancy_title_left.png|_fancybox/fancybox/fancy_shadow_w.png|_fancybox/fancybox/fancy_shadow_sw.png|_fancybox/fancybox/fancy_shadow_se.png|_fancybox/fancybox/fancy_shadow_s.png|_fancybox/fancybox/fancy_shadow_nw.png|_fancybox/fancybox/fancy_shadow_ne.png|_fancybox/fancybox/fancy_shadow_n.png|_fancybox/fancybox/fancy_shadow_e.png|_fancybox/fancybox/fancy_nav_right.png|_fancybox/fancybox/fancy_nav_left.png|_fancybox/fancybox/fancy_loading.png|_fancybox/fancybox/fancy_close.png|_fancybox/fancybox/blank.gif|_images/topMenuImages.png|_images/bg_slider4.png|_images/bg_jScrollbar_draggable.jpg|_images/bg_draggable5.png|_images/bg_draggable4.png|_images/header_logo.png|_images/home_logo.png|storage/events/2/event01.jpg)$">
ExpiresActive on
ExpiresDefault "access plus 1 month"
</FilesMatch>
# Good for one week
ExpiresByType application/x-javascript M604800
ExpiresByType text/css M604800
ExpiresByType text/html M604800
Web 浏览器中的输出是:内部服务器错误 500 The server encountered an internal error or misconfiguration and was unable to complete your request....。我已经评论了编辑文件扩展名(.php 和 .html)的块。我还取出了整个 FileMatch 部分,但它仍然不断出现内部服务器错误。
感谢您对此问题的任何评论或反馈。非常感谢您的宝贵时间,我很感激。
问候,
NMV
【问题讨论】:
-
Apache error_log 中出现了什么?
-
顺便说一句,您不需要在一个文件中使用两次
RewriteEngine on。只需在顶部定义它 -
谢谢塞尔吉奥。我正在维护代码,我会采纳你的建议。
-
谢谢@JRD,我忘记了调试必不可少的东西。在 Apache 错误日志中出现 ...C:/wamp/www/html/system/.htaccess: Invalid command 'ExpiresActive',可能拼写错误或由未包含在服务器配置中的模块定义。 Expirestype 也显示相同。如果我在 .htaccess 文件中评论这些内容,那么网站就会出现,但没有一些样式。
-
你能确认你启用了模块 mod_expires 吗?您的 apache 配置应该类似于
LoadModule expires_module modules/mod_expires.so