Include File In .htaccess?

liunx

Guest
Hi All!<br /><br />I'm wondering if anyone knows how to include a file to be processed within the .htaccess file. What I'm looking to do is have a list of IPs generated by a CGI be included for processing in my .htaccess file.<br /><br />Basically, I have a section like this:<br /><br /><Files *.cgi><br />order allow,deny<br />allow from all<br />deny from XX.XX.XX.XX<br />deny from XX.XX.XX.XX<br />...etc...<br /></Files><br /><br />Then I have a CGI I wrote which catches spam bots trying to post to a form on my site, and logs their IP address to a text file in the "deny from XX.XX.XX.XX" fashion. I'd like to have my .htaccess refer to this file to add them to my "deny from" list for CGIs. Can this be done?<!--content-->
Unfortunately, you cannot include files in .htaccess.<!--content-->
Darn! Well, I don't like the idea of automatically editing the .htaccess directly through CGI, so I guess I'll just have to periodically cut & paste the list myself.<br /><br />Thanks for the info!<!--content-->
Since we're on the topic of including files, is there a way to have a header.php and a footer.php file get processed on every page?<br /><br />Currently, I just put the include lines in my code at the beginning and end manually, but there are some pages on my site that I made before I knew about including, and it would be nice to be able to update them.<!--content-->
As far as I'm aware, the only way is via an inclusion in the php. (Unless you wanted to redirect every page to a single php file, that adds the header / footer, and then includes the information from the page they asked for .... but that get's very messy <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" /> )<!--content-->
TCH-Andy,<br />Messy to code? Can you elaborate?<br /><br />It's actually the very process I use on many sites, and was wondering why you think it's messy.<!--content-->
Surefire,<br /><br />Purely because he has some files which already have include pages, and some that don't, and the pages aren't already designed to be used as includes, so you would need to take account of that in the coding of the main page (or rewrite many of the other pages).<br /><br />If you are starting your design from scratch, using that method (I have on a couple of my sites) then I'd agree, it's not messy then.<!--content-->
 
Back
Top