.htaccess - 如何从 litespeed 服务器上的 url 隐藏 index.php
问题描述
url -example.com/index.php
想要隐藏/index.php
htaccess
已启用 - 其他一些规则有效
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
不起作用。index.php
仍然存在
可能是因为我的服务器litespeed
没有apache
任何帮助
解决方案
根据您显示的示例,请尝试以下操作。
使用任一代码:
RewriteEngine ON
RewriteRule ^index\.php/?$ http://%{HTTP_HOST}/ [NC,R=301]
RewriteRule ^/?$ index.php [L]
或使用THE_REQUEST
变量尝试:
RewriteEngine ON
RewriteCond %{THE_REQUEST} \sindex\.php\s [NC]
RewriteRule ^ http://%{HTTP_HOST}/ [NC,R=301]
RewriteRule ^/?$ index.php [L]
推荐阅读
- javascript - 出现在 React.js 中时如何将模式滚动设置为顶部
- r - ROracle 软件包安装失败
- maven - 带有 moditect 和 Java 11 的 JavaFX Maven
- linux - 分段错误 - 如何调试?
- c# - 将字符串转换为浮点数,程序不说数据
- drupal - 使用 drupal 查询构建器添加 FORCE INDEX
- java - Docusign REST API 启动失败
- google-analytics - Google Analytics Advanced Filter = ?utm 返回一些结果
- android - LinearLayout 可见性不是“GONE”,也不会在 android 4.4.4 上显示
- superset - 如何为超集中的日期字段“filter_immune_slice_fields”?