簡體   English   中英

.htaccess和Apache ModSecurity

[英].htaccess and Apache ModSecurity

我有這個.htaccess

Options -Indexes

    RewriteEngine On
    RewriteBase /

    # Force to exclude the trailing slash
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.*)/$
    RewriteRule ^(.+)/$ $1 [R=307,L]

    # Restrict php files direct access
    # this part generate the problem
    RewriteCond %{THE_REQUEST} ^.+?\ [^?]+\.php[?\ ]
    RewriteRule \.php$ - [F] 

    # Allow any files or directories that exist to be displayed directly
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteRule ^(.*)$ index.php?$1 [QSA,L]

但阿帕奇給我寫了這個:

ModSecurity:警告。 需要匹配“在%{tx.allowed_methods}內”與“REQUEST_METHOD”。 [file“/modsecurity/modsecurity_crs_30_http_policy.conf”] [line“31”] [id“960032”] [rev“2”] [msg“策略不允許使用方法”] [data“GET”] [severity“CRITICAL “] [ver”OWASP_CRS / 2.2.9“] [maturity”9“] [准確度”9“] [tag”OWASP_CRS / POLICY / METHOD_NOT_ALLOWED“] [tag”WASCTC / WASC-15“] [tag”OWASP_TOP_10 / A6 “] [tag”OWASP_AppSensor / RE1“] [tag”PCI / 12.1“]

我該如何編輯我的htaccess? 多謝你們。

正如第一條評論所說,您有一條阻止您的請求的ModSecurity規則。 如果您的托管服務提供商在構建ModSecurity時啟用了“--enable-htaccess-config”,那么您可以從htaccess文件中禁用該特定規則。 您可以使用類似於以下內容的內容:

<IfModule mod_security.c> SecRuleRemoveById 960032 </IfModule>

但是,如果您的提供者尚未啟用此功能,並且您無權訪問任何Apache配置文件(httpd.conf等)。 然后,您將必須與托管服務提供商聯系以解決此問題。 抱歉

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM