本地 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
《L05 电商实战》
从零开发一个电商项目,功能包括电商后台、商品 & SKU 管理、购物车、订单管理、支付宝支付、微信支付、订单退款流程、优惠券等
《L03 构架 API 服务器》
你将学到如 RESTFul 设计风格、PostMan 的使用、OAuth 流程,JWT 概念及使用 和 API 开发相关的进阶知识。
讨论数量: 1

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

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

6年前 评论

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