我是第一次使用 Lumen。我将流明文件放在文件夹 Test 中,并将文件夹保存在服务器的 /var/www/html 路径中。我的 PHP 版本是7.4.3我有以下路线:$router->get('/key', function() {return str_random(32);});$router->get('/', function () use ($router) {return $router->app->version();});下面是我的htaccess:<IfModule mod_rewrite.c><IfModule mod_negotiation.c> Options -MultiViews -Indexes</IfModule>RewriteEngine On# Handle Authorization HeaderRewriteCond %{HTTP:Authorization} .RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]# Redirect Trailing Slashes If Not A Folder...RewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{REQUEST_URI} (.+)/$RewriteRule ^ %1 [L,R=301]# Handle Front Controller...RewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{REQUEST_FILENAME} !-fRewriteRule ^ index.php [L]</IfModule>但是每当我尝试访问http://xx.xxx.xxx.xxx/Test/public/key时,它都会显示在此服务器上找不到请求的 URL。但是如果我尝试访问http://xx.xxx.xxx.xxx/Test/public/它会返回给我Lumen (5.7.8) (Laravel Components 5.7.*)我怎样才能使所有其他路线也可以工作?
2 回答

呼唤远方
TA贡献1856条经验 获得超11个赞
我在 /etc/apache2/apache2.conf 文件中搜索了< Directory /var/www/ >并更改了以下内容
AllowOverride None
至
AllowOverride All
并重新启动 apache。它解决了我的问题。
- 2 回答
- 0 关注
- 130 浏览
添加回答
举报
0/150
提交
取消