I need to block visits to specific URLs within my site. But I am unsure how to, and is terrible at understanding the intricacies of htaccess. ^^
I need to block visits that are accessing these type of URLs, for eg.
- http://mydomain.com/katherine-blouse-on-fire
- http://mydomain.com/antique-for-preservation
- http://mydomain.com/?type=extended&name=stackoverflow
My current htaccess code
DirectoryIndex index.html index.php
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !\.(png|gif|ico|swf|jpe?g|js|css)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php?sef_rewrite=1 [L,QSA]
</IfModule>
<Files 403.shtml>
order allow,deny
allow from all
</Files>
deny from xx.xx.xx.xx
deny from xx.xx.xx.xx
What should I enter into htaccess to block these visits? And in which order? Before my current code or after?
You may or may not wish to use
mod_alias
if you've got it available; the syntax is slightly more readable but it will only match paths (i.e. not query-strings):Add the below after your
RewriteBase /
beforeRewriteCond %{REQUEST_FILENAME} !\.(png|...
. It will return a403 Forbidden status code
to the client.Definition: