本地 Laravel 项目无法加载,是否是 htaccess 的配置问题?

环境 MAMP 5.0.1 / MAC OS
情况是这样的:从服务器上把laravel 项目复制到本地后,无法加载任何页面

  1. 正常加载 .htaccess 后,提示如下

            Internal Server Error
            The server encountered an internal error or misconfiguration and was unable to complete your request.
    
            Please contact the server administrator, webmaster@dummy-host2.example.com 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.
  2. 如果不加载htaccess,提示
    Not Found
    The requested URL /public was not found on this server.

htaccess 里的内容:

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

    RewriteEngine On

    RewriteRule ^$ http://www.code111.com/cn/ch.html [R=301,L]

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

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    RewriteCond %{REQUEST_URI} !(\.css|\.js|\.png|\.jpg|\.gif|\.ico|\.svg|\.woff|\.otf|\.ttf|\.pdf|robots\.txt)$ [NC]
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} !^/public/
    RewriteRule ^(css|fonts|i|js|pdf|uploads|lib)/(.*)$ public/$1/$2 [L,NC]

    RewriteEngine On
</IfModule>
gobro
《L01 基础入门》
我们将带你从零开发一个项目并部署到线上,本课程教授 Web 开发中专业、实用的技能,如 Git 工作流、Laravel Mix 前端工作流等。
《L02 从零构建论坛系统》
以构建论坛项目 LaraBBS 为线索,展开对 Laravel 框架的全面学习。应用程序架构思路贴近 Laravel 框架的设计哲学。
讨论数量: 1

这个要修改 看看手册里头 有写的 默认的不能用 改成这样
Options +FollowSymLinks
RewriteEngine On

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

5年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!