我在 Ubuntu 19.10 中使用 Laravel。問題是當我嘗試訪問 project_name/login 時,它說在服務器上找不到請求 url。我試圖更改 apache2.conf 并更改我 laravel 項目的公共文件夾中的 .htaccess 。但它不起作用..這是 /etc/apache2/ 中的 apache2.conf這是我項目公共文件夾中的 .htaccess<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>我已經用這樣的命令啟用了 a2enmod 重寫 sudo a2enmod rewrite
2 回答

慕婉清6462132
TA貢獻1804條經驗 獲得超2個贊
VirtualHost(在 /etc/apache2/sites-enabled/ 中)的 DocumentRoot 必須指向 /public
<VirtualHost *:80>
...
DocumentRoot /{Where your project is}/public
...
</VirtualHost>
然后重啟 Apache
- 2 回答
- 0 關注
- 282 瀏覽
添加回答
舉報
0/150
提交
取消