Jump to content

Recommended Posts

Posted

Hi All!

 

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.

 

Basically, I have a section like this:

 

<Files *.cgi>

order allow,deny

allow from all

deny from XX.XX.XX.XX

deny from XX.XX.XX.XX

...etc...

</Files>

 

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?

Posted

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.

 

Thanks for the info!

Posted

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?

 

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.

Posted

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 :) )

Posted

TCH-Andy,

Messy to code? Can you elaborate?

 

It's actually the very process I use on many sites, and was wondering why you think it's messy.

Posted

Surefire,

 

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).

 

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...