我正在使用LiteSpeed 7。我有一个删除文件扩展名的.htaccess文件,但是LiteSpeed不支持它。
我的.htaccess是这样的:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php
RewriteRule ^([a-z]+)\/?$ $1.php [NC]
</IfModule>我的项目文件需要.html和.php文件。
我该怎么做呢?
发布于 2018-07-26 23:03:46
LiteSpeed网络服务器的当前版本是5.2.x和5.3RC2,看起来还不是7。
试过你的规则,看起来没问题。访问www.example.com/phpinfo,成功重定向至www.example.com/phpinfo.php
也许在当前规则之后,你还有其他规则?
发布于 2018-12-25 22:28:42
我发现这个区块必须被删除:
# Access block for files
# Apache < 2.3
<IfModule !mod_authz_core.c>
<FilesMatch "(?i:^\.|^#.*#|^(?:ChangeLog|ToDo|Readme|License)(?:\.md|\.txt)?|^composer\.(?:json|lock)|^ext_conf_template\.txt|^ext_typoscript_constants\.txt|^ext_typoscript_setup\.txt|flexform[^.]*\.xml|locallang[^.]*\.(?:xml|xlf)|\.(?:bak|co?nf|cfg|ya?ml|ts|typoscript|tsconfig|dist|fla|in[ci]|log|sh|sql(?:\..*)?|sqlite(?:\..*)?|sw[op]|git.*)|.*(?:~|rc))$">
Order allow,deny
Deny from all
Satisfy All
</FilesMatch>
</IfModule>
# Apache ≥ 2.3
<IfModule mod_authz_core.c>
<If "%{REQUEST_URI} =~ m#(?i:/\.|/\x23.*\x23|/(?:ChangeLog|ToDo|Readme|License)(?:\.md|\.txt)?|/composer\.(?:json|lock)|/ext_conf_template\.txt|/ext_typoscript_constants\.txt|/ext_typoscript_setup\.txt|flexform[^.]*\.xml|locallang[^.]*\.(?:xml|xlf)|\.(?:bak|co?nf|cfg|ya?ml|ts|typoscript|tsconfig|dist|fla|in[ci]|log|sh|sql(?:\..*)?|sqlite(?:\..*)?|sw[op]|git.*)|.*(?:~|rc))$#">
Require all denied
</If>
</IfModule>但是如何取代它呢?
https://stackoverflow.com/questions/51537519
复制相似问题