【问题标题】:Internal Server Error using WAMP server使用 WAMP 服务器的内部服务器错误
【发布时间】:2015-02-25 09:42:01
【问题描述】:

我使用php 创建了一个MVC 应用程序,但是当我尝试访问这些网址时,它显示“服务器遇到内部错误”

当我检查它给我的日志时:

内部服务器错误

服务器遇到内部错误或配置错误,无法完成您的请求。
请通过 admin@example.com 与服务器管理员联系,告知他们此错误发生的时间,以及您在此错误之前执行的操作。
服务器错误日志中可能会提供有关此错误的更多信息。

我的.htaccess文件代码:

Options-MultiViews
RewriteEngine On

RewriteBase/MVC/public

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f


RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]

【问题讨论】:

  • 确保您的 apache 设置中的 mod_rewrite 为 ON
  • 哪个日志?您检查过 Windows 中的事件日志和 Apache 中的错误日志吗?
  • @amit 如何在 php 中使用 mod_rewrite 是新的
  • @anubhava 不工作
  • 检查您的 Apache error.log 以获取实际的错误消息。

标签: php .htaccess wamp


【解决方案1】:

当基本模块未启用时,Wampserver 会遇到此问题

您可以通过以下方式启用它们:

  • 左键单击 Wampsever 图标

  • 转到 APACHE -> APACHE 模块

  • 向下滚动并找到“rewrite_module”和“headers_module”

  • 然后标记他们检查

它会自动重启。完成。

【讨论】:

    【解决方案2】:

    这个问题是由于 wampserver 使用本地。

    你可以改变它:

    • 左键单击 wampsever

    • 转到 APACHE -> APACHE 模块

    • 向下滚动并找到“rewrite_module”

    • 然后标记它检查

    它会自动重启。一切就绪。

    【讨论】:

    • @HebeleHododo 我已经尝试过了,但它不起作用。仍然面临同样的错误
    • @HebeleHododo,尝试停止所有服务并重新启动
    【解决方案3】:

    要启用 mod_rewrite,请执行以下步骤:

    1. Find and open the file .http.conf. This will be located in your Apache install folder.
    2. Make a backup of http.conf which you can restore from, if anything were to go wrong
    3. Find the line #LoadModule rewrite_module modules/mod_rewrite.so and remove the hash ‘#’
    4. Locate the block within the directory tags as indicated below and change to:
    <directory />
    Options All
    AllowOverride All
    </directory>
    5. Find any additional occurrences of the line “AllowOverride None” and change it to “AllowOverride All”.
    6.Finally, restart apache server and your browser. The .htaccess rewriting should now be working for any local website.
    

    【讨论】:

    • C:/wamp/www/MVC/app/.htaccess: 无效的命令“选项索引”,可能拼写错误或由未包含在服务器配置中的模块定义
    • 还要确保 mod_rewrite 已打开。使用代码创建 test.php 文件 执行它并查看 mod_rewrite 是打开还是关闭
    • 我的apache版本是2.4.9
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-02-15
    相关资源
    最近更新 更多