【问题标题】:.htaccess file works at localhost or not ?? if yes How?.htaccess 文件是否在本地主机上工作?如果是怎么办?
【发布时间】:2014-05-19 12:33:17
【问题描述】:

我的 htaccess 文件中有以下代码:


Options +FollowSymLinks -MultiViews


RewriteEngine On

RewriteBase /


RewriteRule ^forums/ - [L,NC]


RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]

RewriteRule ^ %1 [R,L]



RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_FILENAME}.php -f

RewriteRule ^(.*?)/?$ $1.php [L]


------------------------------------------------

我的 .htaccess 目录是这样的:

..wamp/www/.htaccess

我的网站目录是这样的

..wamp/www/Careers

当我加载我的职业文件夹或本地主机时,它会给出一个错误:

Internal Server Error

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

Please contact the server administrator, admin@localhost 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.

【问题讨论】:

  • 您在 apache 错误日志中可以看到什么?它可能在wamp/logs/ 文件夹中。它应该有一个错误。也许你的重写模块没有加载?
  • 查看您的错误日志 (Apache) 并找到错误。
  • 如何加载重写模块??

标签: php .htaccess seo localhost


【解决方案1】:

如果您在网站上使用 .htaccess,它可能会干扰您尝试加载到浏览器中的网页。请仔细检查 .htaccess 配置。任何语法错误都会导致显示 500 Internal Server Error 消息而不是您的网站。

要确认 .htaccess 配置错误是否是导致 500 Internal Server 错误的原因,请暂时删除或重命名 .htaccess 文件,然后尝试重新加载页面。

您可以在线查询htaccess tester

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-09-28
    • 1970-01-01
    • 2015-10-15
    • 2017-09-05
    • 1970-01-01
    • 2015-02-10
    • 2013-06-14
    相关资源
    最近更新 更多