Laravel 版本 - 5.8。我必須在不使用php artisan serve命令的情況下在共享主機上部署我的 Laravel 項目。因此,我已將我的根文件server.php文件重命名為index.php。如果我將文件server.php重命名為index.php會不會有任何安全后果或錯誤?
2 回答

長風秋雁
TA貢獻1757條經(jīng)驗 獲得超7個贊
您不需要將 server.php 重命名為 index.php。只需將 Public/index.php 移動到文件夾的根目錄,并在移動后更改 index.php 內的必要路徑。它肯定會起作用。

aluckdog
TA貢獻1847條經(jīng)驗 獲得超7個贊
如果您使用 cPanel,您可以將 webroot 更改為public非常簡單的不需要重命名server.php. 如果沒有,您可以使用.htaccess將所有請求重定向到這樣的public文件夾:
# public_html/.htaccess
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect All Requests To The Subfolder
RewriteRule ^ /public
</IfModule>
- 2 回答
- 0 關注
- 246 瀏覽
添加回答
舉報
0/150
提交
取消