[英]Namecheap LiteSpeed Problem when Posting data from html form
I am facing a problem when trying to post data to my PHP from html form.我在尝试将数据从 html 表单发布到我的 PHP 时遇到问题。 The issue is as follows:
问题如下:
To solve this error, @qtwrk's comment is correct that you must use the following code in your .htaccess.要解决此错误,@qtwrk 的评论是正确的,您必须在 .htaccess 中使用以下代码。
<IfModule mod_security.c>
SecRuleEngine Off
SecRequestBodyAccess Off
</IfModule>
WordPress running on Litespeed Server will often fail with a 403 error when you try to post any content while creating new pages and posts in WP Admin.当您在 WP Admin 中创建新页面和帖子时尝试发布任何内容时,在 Litespeed Server 上运行的 WordPress 通常会失败并出现 403 错误。 This code solves that issue.
这段代码解决了这个问题。
A solution about disabling should help but it decreases security — stops doing that.
关于禁用的解决方案应该有所帮助,但它会降低安全性——停止这样做。
Better to spend more time understanding the main reason and for example configure mod_security for Wordpress:最好花更多时间了解主要原因,例如为 Wordpress 配置 mod_security:
Based on this article you can disable some rules directly for wp-admin
directory:基于这篇文章,您可以直接为
wp-admin
目录禁用一些规则:
<LocationMatch "/wp-admin/">
SecRuleRemoveById 300013
SecRuleRemoveById 300014
SecRuleRemoveById 300015
SecRuleRemoveById 300016
SecRuleRemoveById 300017
</LocationMatch>
Based on this article you can disable some rules directly for sub-directories:基于这篇文章,您可以直接为子目录禁用一些规则:
<LocationMatch "/wp-admin/admin-ajax.php">
SecRuleRemoveById 300013
SecRuleRemoveById 300015
SecRuleRemoveById 300016
SecRuleRemoveById 300017
SecRuleRemoveById 949110
SecRuleRemoveById 980130
</LocationMatch>
<LocationMatch "/wp-admin/page.php">
SecRuleRemoveById 300013
SecRuleRemoveById 300015
SecRuleRemoveById 300016
SecRuleRemoveById 300017
SecRuleRemoveById 949110
SecRuleRemoveById 980130
</LocationMatch>
<LocationMatch "/wp-admin/post.php">
SecRuleRemoveById 300013
SecRuleRemoveById 300015
SecRuleRemoveById 300016
SecRuleRemoveById 300017
SecRuleRemoveById 949110
SecRuleRemoveById 980130
</LocationMatch>
If you want to be sure that mod_security
is used you can wrap the settings above in this:如果你想确保使用了
mod_security
,你可以将上面的设置包装在下面:
<IfModule mod_security.c>
# ...
# <LocationMatch ...>
# ...
</IfModule>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.