
由於某種原因,以下 htaccess將要/boot.ini.htm
如果測試的 url 是,則重定向到 404 頁面不是如果是/boot.ini%2500.htm
。
我需要更改什麼才能使其正常工作,還是這是一個錯誤?
Options All -Indexes
Options +FollowSymlinks
ErrorDocument 403 /site/404
ErrorDocument 404 /site/404
RewriteEngine On
RewriteRule ^(fonts)($|/) - [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([\s\S]*)$ index.php/$1 [L,NC,QSA]
# Ensure Authorization header is passed along
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
ServerSignature Off
php_value memory_limit 256M
我的伺服器是:
伺服器版本:Apache/2.4.41(Ubuntu)
伺服器建成時間:2021-06-17T18:27:53
答案1
在所有情況下,我都會看到預設的 Apache 404 回應
在這種情況下,Codeigniter 肯定不會處理該請求。看起來 404 是由 Apache 伺服器觸發的,.htaccess
甚至在處理之前。這很可能是由 mod_security 之類的東西觸發的(HTTP 回應標頭中可能有一些線索)。
包含的 URL%
可能會造成安全威脅。因此,在伺服器上設定一攬子規則來簡單地阻止這些請求並不一定是不尋常的。除非您能夠以某種形式存取伺服器配置,否則您不可能採取任何措施來影響這一點。
但它已經返回 404。404 畢竟是 404,所以它不會對機器人產生任何影響。和真實的無論如何,用戶不應該提出這樣的請求。