Want to throw 404 Errors when URL contains a certain string - Wordpress

admin

Administrator
Staff member
I am managing a wordpress blog and want to throw a 404 error whenever the url contains a string pattern (example: if the url contains "thisisnotwanted"). I was thinking I will be able to add something to the htaccess file like: Redirect "<em>thisisnotwanted</em>" 404

Can someone help? I just don't want Google to index pages with this parameter.