【问题标题】:apache 2.4 php and laravel - friendly urlsapache 2.4 php 和 laravel - 友好的 url
【发布时间】:2014-03-11 04:41:42
【问题描述】:

自从过去几个小时以来,我一直在努力让我的友好网址发挥作用。 我有 apache 2.4 和 php 设置。该应用程序是使用 laravel 4 构建的

所以虽然这个http://machinename:90/helpsystem/index.php/categories 有效,但以下有效http://machinename:90/helpsystem/categories

我在 apache 的 httpd.conf 文件中启用了 mod_rewrite 模块 此外,我已将此添加到 httpd.conf 的别名模块部分

ScriptAlias /helpsystem "c:/Apache24/htdocs/helpsystem/public"

public 是 laravel 应用的公用文件夹

我的目录部分看起来像这样

<Directory "c:/Apache24/htdocs/helpsystem/public">
    Options Indexes Includes FollowSymLinks MultiViews
    AllowOverride AuthConfig FileInfo
    Order allow,deny
    Allow from all
</Directory>

.htaccess 文件看起来像这样

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

你能告诉我我做错了什么吗?

谢谢

【问题讨论】:

    标签: php apache laravel


    【解决方案1】:

    重启 apache2 后,AllowOverride All 应该可以解决您的问题

    <Directory c:/Apache24/htdocs/helpsystem/public/>
            Options Indexes FollowSymLinks
            AllowOverride All
            Require all granted
    </Directory>
    

    【讨论】:

      【解决方案2】:

      查看Apache's upgrade guide from 2.2 to 2.4

      由于现在大多数 linux 发行版(尤其是 Debian/Ubuntu)都发布了 2.4+,因此您会看到很多这种情况。我看到你在 Windows 上,所以看起来你碰巧使用的任何东西都更新了!具体来说,

      Order allow,deny Allow from all

      已替换为 Require all granted,因为 Apache 现在使用 mod_authz_host

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2017-03-06
        • 1970-01-01
        • 2017-04-12
        • 2016-04-13
        • 2019-04-30
        • 2015-01-31
        • 2015-03-23
        相关资源
        最近更新 更多