【问题标题】:How to use Laravel an OSX Mavericks and MAMP 5.4.14 using an alias?如何使用 Laravel、OSX Mavericks 和 MAMP 5.4.14 使用别名?
【发布时间】:2014-03-22 21:42:50
【问题描述】:

我是第一次尝试 Laravel,并将它与现有的 MAMP 5.4.14(PHP 5.4.14,Apache 2)一起安装在我的 Mac(OSX Mavericks)上。我在 MAMP 上安装了各种其他项目(CakePHP),并且从别名目录提供文件没有问题。但是 Laravel 似乎不喜欢它附带的配置或我用于 CakePHP 的配置,我还没有找到解决方案。

在我的 Apache 配置中,我将其定义为我的别名:

Alias /laravel/ "/Users/user1/Documents/Web Development/laravel/public/“

<Directory "/Users/user1/Documents/Web Development/laravel/public”>
Options +Indexes +MultiViews +FollowSymLinks
AllowOverride All
Require all granted
</Directory>

在 Laravel 公用文件夹中,我在 htaccess 中有这个

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /laravel/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>

不幸的是,我得到的只是一个标准的 Apache 403 错误。

[Sat Mar 22 17:29:38.408215 2014] [authz_core:error] [pid 31418] [client ::1:51107] AH01630: client denied by server configuration: /Users/user1/Documents/Web Development/laravel/public/\xe2\x80\x9c

谁能提供一些关于我忽略了什么的提示?谢谢

编辑 - 附加信息

将整个 laravel 目录改成 777 并没有帮助

Laravel app.php 文件有

'url' => 'http://localhost:8080/laravel',

我运行了内部 php 服务器,它工作正常(php artisan serve),尽管它在 base64_decode 上引发了异常

也试过默认的htaccess

<IfModule mod_negotiation.c>
    Options -MultiViews
</IfModule>

RewriteEngine On
RewriteBase /laravel/

# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]

# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

【问题讨论】:

    标签: macos apache laravel alias mamp


    【解决方案1】:

    好吧,我应该注意到 apache 消息中的 \xe2\x80\x9c ,这是可怕的大引号。在编辑器之间复制和粘贴设法弄乱了我的配置文件。这是最终配置仅供参考:

    Apache 别名配置:

    Alias /laravel/ "/Users/user1/Documents/Web Development/laravel/public/"
    Alias /laravel "/Users/user1/Documents/Web Development/laravel/public"
    
    <Directory "/Users/user1/Documents/Web Development/laravel/public">
        Options +Indexes +MultiViews +FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
    

    我的laravel项目中的htaccess文件是默认的

    <IfModule mod_rewrite.c>
        <IfModule mod_negotiation.c>
            Options -MultiViews
        </IfModule>
    
        RewriteEngine On
        RewriteBase /laravel/
    
        # Redirect Trailing Slashes...
        RewriteRule ^(.*)/$ /$1 [L,R=301]
    
        # Handle Front Controller...
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^ index.php [L]
    </IfModule>
    

    我可以访问它

    http://localhost:8080/laravel/
    

    希望这对其他人有帮助!

    【讨论】:

      猜你喜欢
      • 2013-12-29
      • 1970-01-01
      • 2015-12-06
      • 2013-11-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-07-31
      • 2013-08-25
      相关资源
      最近更新 更多