How can I use htaccess to redirect URLs containing a specific word to 410 error?

41 Views Asked by At

recently I develope a new cms and need to redirect 410 some urls that contains specific word which had been created from my old Cms

some url like the below

https://www.domin.com/category-laptop/filter/minPrice-11000000/maxPrice-293000000/Attributes-41_3862-41_3940-41_3961-/page-2

i need a code for Htaccess that when we have the filter Word in our url, redirect it to 410

for example

https://www.domin.com/category-laptop/filter/minPrice-11000000/maxPrice-293000000

return 410 redirect

or

https://www.domin.com/category-laptop/filter/Attributes-41_3862-41_3940-41_3961-/page-2

return 410 redirect

it doesn't matter where Filter keyword is located

simpely i need a code in htaccess that redirect to 410 When url has the keyword : filter ,but when it does not exist do nothing

i try this code but not work

RewriteCond %{QUERY_STRING} filter RewriteRule .* - [R=410,L]

//i means if isset filter in url Redirect to 410

or

RewriteRule filter\/* [R=410,L]

//i means if isset filter and then everything after that,redirect to 410 or

Redirect gone /*filter

0

There are 0 best solutions below