IsaacSchlueter Posted June 17, 2005 Share Posted June 17, 2005 (edited) I would like to use a RewriteMap to bounce known referrer spammers off of my site before they have a chance to waste my bandwidth. I found a tutorial at http://httpd.apache.org/docs/misc/rewriteguide.html (Referrer-Based Deflector) that I'd like to use, and I am going to write a php script to generate the map out of a database as needed (whenever a new item is added to the db, that is.) However, when I set up a test at http://www.isaacschlueter.com/tests/rewrite_map_tests/ I'm just getting an HTTP 500 error. My errorlog shows: >[Fri Jun 17 14:06:46 2005] [alert] [client 64.0.158.34] /home/My_User_Name/public_html/tests/rewrite_map_tests/.htaccess: RewriteMap not allowed here First question: Are we allowed to use RewriteMap directives at all, or am I wasting my time? Second question: Is there some part of my site where it'd be allowed, but perhaps it's just not allowed in /tests/rewrite_map_tests? For reference, here's what it says in my .htaccess at the moment: >RewriteEngine On RewriteMap spamdeflector txt:/home/My_User_Name/public_html/tests/rewrite_map_tests/spammerlist.map RewriteCond %{HTTP_REFERER} !="" RewriteCond ${spamdeflector:%{HTTP_REFERER}} ^-$ RewriteRule ^.* %{HTTP_REFERER} [R,L] RewriteCond %{HTTP_REFERER} !="" RewriteCond ${spamdeflector:%{HTTP_REFERER}|NOT-FOUND} !=NOT-FOUND RewriteRule ^.* ${spamdeflector:%{HTTP_REFERER}} [R,L] I've tried accessing it with the relative path (just spammerlist.map or /spammerlist.map instead of the full path) but that didn't work any better. Here's what's in spammerlist.map >http://isaac/ - http://localhost/ - (Keep in mind, this is just a test. This should bounce all requests from my local machine, and I have an index.html which links to it, running on my local box.) Any ideas? Edited June 17, 2005 by IsaacSchlueter Quote Link to comment Share on other sites More sharing options...
TweezerMan Posted June 17, 2005 Share Posted June 17, 2005 First question: Are we allowed to use RewriteMap directives at all, or am I wasting my time? <{POST_SNAPBACK}> The RewriteMap directive can only be used in the main web server config file (httpd.conf) and is not allowed in an .htaccess file. This is a web server (Apache) limitation. Quote Link to comment Share on other sites More sharing options...
IsaacSchlueter Posted June 17, 2005 Author Share Posted June 17, 2005 Ah, well that answers that. I don't suppose that there's any way that I can access my httpd.conf file? I would expect that would be doubtful, since I believe I'm on a shared server and that would affect everyone, woudln't it? What about if I had dedicated server hosting? Would I be able to access the httpd.conf file then? Quote Link to comment Share on other sites More sharing options...
TweezerMan Posted June 17, 2005 Share Posted June 17, 2005 On a shared server, there is only one install of Apache, with one configuration file, that everyone shares. Changes made to the common Apache config file can directly and indirectly affect all other users on that server. With a dedicated server, yes, you would be able to configure the web server however you wanted. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.