wordpress - How to redirect site to 403 if a certain url get variable exists or contains an unwanted value using htaccess -


in site statistics, i'm staring strange urls these:

mysite.com/?p=casino-online-spielen  mysite.com/category/page/2/?p=casino-online-spielen 

i've tried rewrites has messed wordpress rewrites or didn't work. not in htaccess or apache.

<ifmodule mod_alias.c> redirectmatch 403 ?p=(casino|pharmacy) </ifmodule> 

what need htaccess rule sends user 403 error if word casino found, or better yet if ?p= found in url, not supposed happen. fear destroy archive pagination.

on other hand, should allows ?s= variables , whatever in it.

essentially follow @starkeen suggestion , use mod_rewrite eg.

<ifmodule mod_rewrite.c>   rewriteengine on   rewritecond %{query_string} p=(casino|pharmacy)    rewriterule .* - [f,l] </ifmodule> 

note:

  • f = forbidden = 403
  • l = last = doooooo it.

Comments

Popular posts from this blog

dns - How To Use Custom Nameserver On Free Cloudflare? -

python - Pygame screen.blit not working -

c# - Web API response xml language -