Hello, having Apache, PHP webhosting account. Can i use .htaccess to block several IPs and show them custom message? I mean for example i want to block 3 IPs of company CNN 1.2.3.4 2.3.4.5 6.7.8.9 and show them message: CNN is not allowed to access this webpage. Please which .htaccess rule can i use? Or if this is not possible on shared hosting account, what about redirect for this group of IPs, how it would look like? thank you
You cant redirect users to custom page with some messages via .htaccess, but you can made custom 403 error-page adding " ErrorDocument 403 /dir/file.html" and then "Deny from 1.2.3.4"
Thx, that is a good idea. I also found that i can use following: note that last IP in the ban list must not have "[OR]" and allowedbyallips.html is a page which will be accessible for all IPs even those i redirect
Order Deny,Allow Deny from 125.8.244.244 using this format you can deny from htaccess file check this tool http://www.htaccesstools.com/block-ips/
Since you are wanting custom error pages for "different sets" of IPs the best approach would be the rewrite rule you posted above.