Error: The requested URL /login was not found on this server. (Laravel)
Error: The requested URL /login was not found on this server. (Laravel)
PHP 7.4.9
Laravel 7.20.0
Appache 2.4.6
RedHat 7
我在服务器上部署了我的 laravel 项目,但收到以下错误:
Not Found
The requested URL /login was not found on this server.
我尝试了几乎所有在网上找到的解决方案。
问题保持不变。
mod_rewrite 已启用。
我向 httpd.conf 添加了多行并修复了 DocumentRoot
/etc/httpd/conf/httpd.conf
DocumentRoot "/var/www/html/chatbot/public"
<Directory "/var/www/html/chatbot/public">
AllowOverride All
</Directory>
/var/www/html/chatbot/public/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]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
请注意,当我尝试 link DocumentRoot 到一个新的 laravel 项目时,它工作正常,但对于部署的代码它不起作用(收到上述错误)。
Public 文件夹:
laravel 文档:
If the .htaccess file that ships with Laravel does not work with your
Apache installation, try this alternative:
Options +FollowSymLinks -Indexes
RewriteEngine On
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
在此之后应用并重新启动您的 Apache 服务器
我的问题太愚蠢了。
我更改了文件夹名称:
htaccess
收件人:
.htaccess
PHP 7.4.9
Laravel 7.20.0
Appache 2.4.6
RedHat 7
我在服务器上部署了我的 laravel 项目,但收到以下错误:
Not Found
The requested URL /login was not found on this server.
我尝试了几乎所有在网上找到的解决方案。 问题保持不变。 mod_rewrite 已启用。 我向 httpd.conf 添加了多行并修复了 DocumentRoot
/etc/httpd/conf/httpd.conf
DocumentRoot "/var/www/html/chatbot/public"
<Directory "/var/www/html/chatbot/public">
AllowOverride All
</Directory>
/var/www/html/chatbot/public/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]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
请注意,当我尝试 link DocumentRoot 到一个新的 laravel 项目时,它工作正常,但对于部署的代码它不起作用(收到上述错误)。
Public 文件夹:
laravel 文档:
If the .htaccess file that ships with Laravel does not work with your Apache installation, try this alternative:
Options +FollowSymLinks -Indexes
RewriteEngine On
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
在此之后应用并重新启动您的 Apache 服务器
我的问题太愚蠢了。 我更改了文件夹名称:
htaccess
收件人:
.htaccess