【发布时间】:2026-01-14 12:30:02
【问题描述】:
如何仅使用 .Htaccess 文件在 cpanel 上上传 larval 项目。我已经看到了更多的例子,但没有正常工作。这是抛出错误是此页面无法正常工作。我将我的项目放在http://www.domainname.com/laravelproject 中。在这里面,我们更改了 public 文件夹中的 index.php 文件。
文件是这个-
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
public/index.php
require __DIR__.'/../filename/vendor/autoload.php';
$app = require_once __DIR__.'/../filename/bootstrap/app.php';
【问题讨论】:
-
谢谢你,但我想把我的项目放在 Public_html 文件夹而不是这个文件夹之外