Forum Moderators: coopster & phranque

Message Too Old, No Replies

Need help with .htaccess file

         

scott

2:33 pm on May 6, 2001 (gmt 0)

10+ Year Member



I'm trying to get my .htaccess file to execute a .htm file like it's a .cgi file and it just isn't working.

I put this line in it:

AddType application/x-httpd-cgi .htm

It's also in a subdirectory. Either I'm using incorrect syntax, or the server won't allow .htaccess files for subdirectories, I guess.

Any ideas?

Brett_Tabke

4:13 pm on May 6, 2001 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



First, make sure .htaccess files are enabled on subdirectories (I'm 99% sure they would be). Create a simple htaccess file in the subdirectory that enables ssi on .htm files.

AddType text/html .htm
AddHandler server-parsed .htm

Now throw a .htm file into the directory with a couple of simple ssi testers:

<!--#printenv -->
</pre>
<!--#ECHO var="DATE_GMT" -->

Now load the htm file in your browser.
---- that done and verified, I don't think you can over right the main server mime type for .htm and .html like files to turn them into cgi's.

Instead just call your cgi from .htm file after you enabled it above:

Don't use EXEC to call them, use Virtual:

<!--#include virtual="myfun.cgi"-->

--- other stuff:
Double check your scripts have execute permissions by trying to run it from a shell command line. If they do, double check that the server doesn't have "specific" majic permissions to execute. Some servers only allow a specific set of permissions before the file will execute. Often those servers have cgi wrappers.

scott

4:28 pm on May 6, 2001 (gmt 0)

10+ Year Member



I got it working. In my main directory I have another .htaccess file with the line:

AddHandler server-parsed .htm .html

-for processing SSI

Got rid of it and the .htaccess in the subdirectory worked fine.

Now how to make the two live in peace in harmony? All my main directory pages are .htm

The script in the sub will only work with a .htm extension too.

Either I re-write the script subbing .html for .htm or I rename all my main directory pages .html.......either way - Ouch!

Unless there's some nifty server trick that'll do it?

Brett_Tabke

5:18 pm on May 6, 2001 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



I don't get the application for .htm as a script over .htm as ssi?

scott

5:25 pm on May 6, 2001 (gmt 0)

10+ Year Member



i did a search and replace in the script..... .htm for .html a few tweaks and all is well now.

Brett check your SM. :)

-scott

there's also a .cgi script in the sub that interacts with the .htm (actually scripts) files.

-gee, i wonder what scott is up to? lol