laravel - 当 index.php 不在 URL 中时,Laravel 8 强制下载而不是在 wamp 上执行 PHP 文件
问题描述
我正在处理我在 WAMP 上的一个项目,现在在域上有一个副本。一切都在网上运行良好,直到最近在 wamp 上运行良好,但从昨天开始我遇到了以下问题:
- 该项目位于 http://localhost/control/public/ ,它显示了登录页面(那里一切正常) - 一旦登录,用户将被重定向到 http://localhost/control/public/cp,这也有效很好,它在 http://localhost/control/public/index.php/cp 也可以正常工作 - 我还有其他页面,例如用于用户管理的部分。如果我使用 URL http://localhost/control/public/index.php/cp/admin/users 它工作正常但是如果我从 URL 中删除 index.php 到 http://localhost/control/public/cp /admin/users 我下载了一个文件(包含 public/index.php 的内容) - 其他一些路由适用于两个版本的 URL(有和没有 index.php),如果 index.php 其他人将推送下载不在网址中。
我找不到这背后的任何逻辑,我猜它可能来自 .htaccess 并且已经看到我可以添加一个 rewriteBase 但我得到了相同的问题。这是我的.htaccess:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
RewriteBase /control/public/
# 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>
任何指针将不胜感激
解决方案
推荐阅读
- css - 如何使用自定义 CSS 修改 Strapi 管理面板?
- python - 如何在 matplotlob 直方图中标记 bin(Python)
- laravel - 重定向标头在 Laravel 中可见而不是隐藏
- spring-boot - 将 java spring boot 应用程序连接到 SAP 事件网格 (BTP)
- properties - 如果之前定义了属性,则不会触发 WebComponents 属性设置器
- java - Java 内存使用细目 - 本机库 (DLL) 使用
- flutter - 在此小部件上方找不到正确的提供程序 - Flutter
- android - 如何确定 SafetyNet Attestation API 已达到 qouta 限制?
- android - 当有多个视频时,VideoView和SurfaceView之间使用哪个?
- android - 使用最新的 Amplify 设置更新已弃用的 AWS Amplify 设置