Forum Moderators: coopster & phranque

Message Too Old, No Replies

.htaccess file configuration

changing the executables for html files

         

jeremy goodrich

3:08 am on Jun 1, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How do I got about this?

I got some advice from my host, which is as follows:

Options ExecCGI
AddType application/x-httpd-cgi .cgi .sh .pl .htm .html

Now, a perl file with the extension .htm processed in the web directory gives a 500 server config error, even though the permissions are set to u+x.

The same file, with a cgi extension, works fine in the web directory. The permissions are the same, too.

sugarkane

8:54 am on Jun 1, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm not 100 percent on this, but I think you also need to add an 'Addhandler' line eg:

AddHandler cgi-script .html

Whether you need both the AddType and AddHandler directives I'm not sure, I think AddHandler might do the trick by itself.

jeremy goodrich

12:41 pm on Jun 1, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Funny story: while editining my .htaccess file, and getting more and more frustrated, I changed permisions on the file to 600, which effectively removed everything. Then I chaned the permissions on the .htaccess file with
chmod u+x .htaccess

Now it works fine, with just these two lines.
Options ExecCGI
AddHandler cgi-script .htm .html

Like you said, it works fine with just these two lines. For anybody else trying this, the permission thing needs to be set correctly, because I was getting a 500 premature end of script headers for a while.

This has been good for me to learn about the apache directives, what handlers are, etc. Painful though, reading all the stuff I could find on .htaccess.

If you're thorough, the reading at the official apache web server home page [apache.org] helps a lot.

sugarkane

1:24 pm on Jun 1, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can also learn a lot by reading the default httpd.conf file that comes with apache - it's extremely well commented, and you can use a lot of the same directives in .htaccess