Forum Moderators: phranque

Message Too Old, No Replies

.htaccess syntax checker?

I hate it when I get it wrong...

         

wruppert

2:44 pm on May 29, 2005 (gmt 0)

10+ Year Member



I check my logs and add "deny from #*$!.xxx.xxx.xxx" to anyone who sucks up 2000 pages in 10 seconds without a glance at robots.txt.

But I must be slightly dyslexic, because I oh so often type "deny form" instead. Which brings down my website.

I would love to have a syntax checker that I could run the file through before I upload it. Anyone seen one?

Googling has not been very useful. Maybe I'm keying in the wrong terms.

jd01

9:28 pm on May 29, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have not seen one, but if you are familiar with php and regex at all, you could actually create a fairly simple on line form that would check it for you... Since you are probably the only one who would be using it, you could actually get fairly elaborate.

Not much of an answer, but may help a little.

Justin

xyretp21

12:44 pm on May 31, 2005 (gmt 0)



I do the following. I move all virtual domain specific configuration to its own file and include the file from the httpd.conf file

In httpd.conf
------
NameVirtualHost *
include etc/apache2/virtual/<domain>
-------

in the <domain> file I insert the deny statement

Then the command "httpd -t" validates syntax in the httpd.conf+ all included files.

root@sigfried# httpd -t
Syntax OK
#root@sigfried

--- with syntax error

root@sigfried# httpd -t
Syntax error on line 31 of /usr/local/etc/apache2/virtual/sotham:
allow and deny must be followed by 'from'

wruppert

4:00 pm on May 31, 2005 (gmt 0)

10+ Year Member



That's a great idea. Sadly, I am on a shared server without ability to touch httpd.conf. Everything must be in .htaccess - I edit it locally and ftp it up.

I'll probably have to write a Perl program.