设置 410 带空格的 url 列表

问题描述

我有一个带有空格的 url 列表,我想将它们设置为消失 (410)

https://www.website.com/Enhanced Category/religions/page/28
https://www.website.com/Enhanced Category/

我在使用 litespeed 服务器的共享主机上...试图对我的 htaccess 上的空间进行编码

https://www.website.com/Enhanced%20Category/religions/page/28
https://www.website.com/Enhanced%20Category/

但是它失败了,url 仍然作为 404... 谁能帮帮我?

我的 htaccess

RewriteEngine On
Redirect 410 /Enhanced%20Category
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule ^ https://www.%1%{REQUEST_URI} [L,NE,R=301]
RewriteRule ^\d{4}/\d\d/([\w-]+\.html)$ /$1 [R=301,L]
<Files xmlrpc.PHP>
Order Allow,Deny
Deny from all
</Files>
Options All -Indexes
# BEGIN wordpress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.PHP$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.PHP [L]
</IfModule>

请求的网址

   https://www.website.com/Enhanced Category return 404 status
   https://www.website.com/Enhanced%20Category return 410 status

解决方法

根据您显示的示例,您能否尝试以下操作。请确保在测试您的 URL 之前清除浏览器缓存,公平警告尚未测试完整的 htaccess 文件,因为 OP 提到了我添加的其他规则。

static Predicate<SoeEntry> comboboxPredicate(Combobox... comboboxes) {
    return Arrays.stream(comboboxes)
                 .filter(combobox -> combobox.getSelectedIndex() > 1)
                 .map(combobox -> (Predicate<SoeEntry>) soeEntry -> soeEntry
                        .getEntryDay()
                        .equals(combobox.getSelectedItem()))
                 .reduce(Predicate::and)
                 .orElseGet(() -> soeEntry -> true);      // "no" filter by default
}