Yudi Anto
Yudi Anto

Reputation: 39

Set 410 list of url with space

I have list of url with space on it , And i want to set them as gone (410)

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

Im on shared hosting using litespeed server...tried to encode the space on my htaccess

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

but it failed, the url still serve as 404...can anyone help me?

My 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>

Requested url

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

Upvotes: 0

Views: 280

Answers (1)

RavinderSingh13
RavinderSingh13

Reputation: 133760

Based on your shown samples, could you please try following. Please make sure you clear your browser cache before testing your URLs, fair warning haven't tested full htaccess file since there are other rules mentioned by OP with my added ones.

<Files xmlrpc.php>
Order Allow,Deny
Deny from all
</Files>

<IfModule mod_rewrite.c>
RewriteEngine ON
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
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,NE,L]

RewriteRule ^index\.php$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

RewriteRule ^Enhanced%20Category/religions/page/28/?$ - [R=401,L]
RewriteRule ^Enhanced Category/?$ - [R=401,L]
</IfModule>

Upvotes: 1

Related Questions