htaccess在litespeed中不起作用 [英] htaccess doesn't work in litespeed

查看:117
本文介绍了htaccess在litespeed中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在网站上使用以下重写,并且在共享服务器上运行良好.

I use the following rewrite on my site and it worked fine in shared server.

 RewriteEngine On
 <Files .*> 
     Order Deny,Allow   
     Deny From All
 </Files>
 <Files ~ "^\.ht">
     order allow,deny
     deny from all
     satisfy all
 </Files>
 <FilesMatch "^php5?\.(ini|cgi)$">
     Order Deny,Allow 
     Deny from All 
     Allow from env=REDIRECT_STATUS 
 </FilesMatch> 
 AddDefaultCharset utf-8
 Options All -Indexes
 RewriteCond %{REQUEST_FILENAME} \.(gif|jpe?g|png|js|css|swf|ico|txt|pdf|xml)$ [OR]
 RewriteCond %{REQUEST_FILENAME} -f [OR]
 RewriteCond %{REQUEST_FILENAME} -s [OR]
 RewriteCond %{REQUEST_FILENAME} -l [OR]
 RewriteCond %{REQUEST_FILENAME} -d
 RewriteRule ^.*$ - [NC,L]
 RewriteRule ^.*$ public_html/index.php [NC,L]   

但是现在它显示以下错误.

But now it shows the following error.

404未找到
在此服务器上找不到请求的资源!
由LiteSpeed Web服务器提供支持
LiteSpeed Technologies对本网站的管理和内容不承担任何责任!

404 Not Found
The resource requested could not be found on this server!
Powered By LiteSpeed Web Server
LiteSpeed Technologies is not responsible for administration and contents of this web site!

如何解决此错误?

它对LiteSpeed的作用不同吗?

推荐答案

根据我的经验,OpenLiteSpeed可以正确加载大多数重写,但是由于可选的初始斜杠,因此必须在规则前面加上"/?".

In my experience OpenLiteSpeed loads most of rewrites correctly but you have to prepend the rules with "/?", because of the optional initial slash.

FilesMatch规则需要在上下文或重写级别设置,请参见此处:

FilesMatch rules need to be set at context or rewrite level, please see here:

https://openlitespeed.org/kb/access-control/#Controlling_Access_to_Files

这篇关于htaccess在litespeed中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆