【发布时间】:2026-01-16 10:50:02
【问题描述】:
这是我的 htaccess 代码。它适用于 Apache,但适用于 Litespeed 不能正常工作。我想将所有 html 和 php 文件放到 index.php 但在 Litespeed 中,
/example *works, there is no file which named example*
/folder/example.php *works, there are folder and example.php*
/folder/index.php *works, there are folder and index.php*
/folder/ *doesn't works, there is folder and there is index.php in this folder but its not redirect to main index*
所以 /folder/index.php 有效,/folder/ 无效。但它们是相同的东西。 htaccess 不理解文件夹是 Litespeed 中的一个 php 文件。
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([A-Za-z0-9-\s]+)/?$ index.php?url=$1 [NC,L,QSA]
RewriteRule ^(.*?\.(?:html?|php))$ index.php?url=$1 [QSA,L,NC]
【问题讨论】: