htaccess适用于Apache,但不适用于litespeed

时间:2018-12-19 11:05:34

标签: php .htaccess litespeed

这是我的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]

1 个答案:

答案 0 :(得分:0)

如何删除

RewriteCond %{REQUEST_FILENAME} !-d 这样可以防止/ folder /被第一个重写规则重写。