.htaccess - 将每个 url 重定向到索引 .php,即使它存在于使用 .htaccess 的项目中
问题描述
我想将每个 url 重定向到 index.php 我的代码只在我的项目中不存在文件时将我带到 index.php。我想重定向 index.php 上的每个 url,即使文件中存在 url。
<IfModule php5_module>
php_value default_charset "ISO-8859-1"
</IfModule>
<IfModule lsapi_module>
php_value default_charset "ISO-8859-1"
</IfModule>
<IfModule mime_module>
AddHandler application/x-httpd-ea-php54 .php .php5 .phtml
</IfModule>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^((?!index\.php).+)$ /index.php [L]
我也已经尝试过了
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [L,QSA]
</IfModule>
解决方案
推荐阅读
- javascript - NPM 测试错误
- angular - “返回时超出最大调用堆栈大小”与“void 类型不存在订阅”冲突
- report - XLSX 报告应显示在 Odoo10 的单张纸中
- python - 从它们用于 islice 时的产量与产量
- python - Python - 机器学习:从数组列表创建训练和测试集
- python - 不知道如何无限循环这个
- node.js - 是什么导致我的 POST 请求失败(使用 Express/Angular 的 CORS)?
- php - jquery php mysql - 当所有项目显示时如何隐藏加载更多按钮
- python - Python中的Flask-mysql fetchall问题
- java - 服务在 android 版本 Oreo 中停止并且应用程序崩溃