I'm very confused right now, I don't know how to block a specific QUERY STRING url via .htaccess file, well actually I want to block this type of url : test.php?q=RANDOMTEXT=&tl=The%20path%20ends Code (markup): If anyone knows how to solve this issue please let me know and thank you in advance (y)
thelastking, You can get this done using the mod_rewrite rule below which checks for the pattern in the entire request. <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{THE_REQUEST} ^.*(test.php\?q=RANDOMTEXT=&tl=The/path/ends).* [NC] RewriteRule ^(.*)$ - [F,L] </IfModule> If the file name part doesnt matter much, you can use the QUERY_STRING variable as given below: <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{QUERY_STRING} ^.*(RANDOMTEXT=&tl=The/path/ends).* [NC] RewriteRule ^(.*)$ - [F,L] </IfModule> I referred the excellent article on blocking requests here : http://perishablepress.com/eight-ways-to-blacklist-with-apaches-mod_rewrite/ Good Luck!