V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
wfdaj
V2EX  ›  PHP

请教,无法指定 public 为根目录的部署问题

  •  
  •   wfdaj · Jun 29, 2021 · 2503 views
    This topic created in 1765 days ago, the information mentioned may be changed or developed.

    找到一个 github 上的轻量级 php 框架: https://github.com/lightpack/lightpack

    像 laravel 等框架一样,默认目录是 public,想使用以下 伪静态 文件,但它不起作用,显示 500 错误。laravel 、tp 等框架可以这样使用的。

    <IfModule mod_rewrite.c>
        RewriteEngine on
        RewriteRule  (.*) public/$1 [L]
    </IfModule>
    

    我也咨询了作者,他也回答了,但是,还是不知道如何转发...😅

    https://github.com/lightpack/lightpack/issues/86

    4 replies    2021-06-29 11:06:25 +08:00
    houshengzi
        1
    houshengzi  
       Jun 29, 2021
    作者不都给你答案了吗,在 Apache 的 vhost 文件配置 DocumentRoot
    wfdaj
        2
    wfdaj  
    OP
       Jun 29, 2021
    @houshengzi 感谢。忘记说了,我使用的虚拟主机,只能配置伪静态文件 .htaccess 。
    MrUser
        3
    MrUser  
       Jun 29, 2021
    rewrite 是相对于 documentRoot 的,既然你的 documentRoot 是 public 就没有必要写成 public/ 了,直接:
    RewriteRule (.*) /$1 [L]
    shiji
        4
    shiji  
       Jun 29, 2021 via iPhone
    如果有耐心就查后台 500 具体是什么错误导致的。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1505 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 40ms · UTC 16:50 · PVG 00:50 · LAX 09:50 · JFK 12:50
    ♥ Do have faith in what you're doing.