Make Apache parse regular HTML files for CGI's

Oct 19, '01 01:05:39AM

Contributed by: robg

If you use CGI's on your web pages (counters, etc.), then you've had to enable "shtml" processing in your httpd.conf file. Sometimes, though, you just want to stick a CGI counter on a plain boring HTML page. The standard solution is to rename the file with a .shtml extension so Apache will parse it. However, if you don't want to rename your files (as you'd then have to fix broken links from other pages), you can use the XBitHack flag in httpd.conf. Enter the following in your /etc/httpd/httpd.conf file:

XBitHack on
This directive tells Apache to treat any file that has the user-execute bit set as a server-parsed html document. So simply change the user 'execute' bit (chmod u+x filename.html) of any of the regular HTML files that you want parsed, and Apache will do the rest.

Remember to stop and restart the server for your changes to take effect. Note that I have not tried this yet on my Apache install, but this is basically right off the Apache documentation pages, so it should work as described.

Comments (3)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20011019010539630