Thursday, December 23, 2021

Prevent category browsing in Wordpress

How to prevent list of categories and values using .htaccess. Place this at the top before # BEGIN WordPress and # BEGIN iThemes Security and other security plugins.

 
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^category/(.*) https://yoursite.com/your/new/url [R=301,L]
#each category
RewriteRule ^country/(.*) https://yoursite.com/your/new/url [R=301,L]
RewriteRule ^state/(.*) https://yoursite.com/your/new/url [R=301,L]
RewriteRule ^language/(.*) https://yoursite.com/your/new/url [R=301,L]
</IfModule>

No comments:

Post a Comment