Forum Moderators: coopster & phranque

Message Too Old, No Replies

AddHandler cgi-script .htm

AddHandler cgi-script .htm

         

StopSpam

8:20 pm on Apr 18, 2003 (gmt 0)

10+ Year Member



I have a question ...

i got a folder with many htm files
and i got one cgi script ...located in same folder

Now i want to give the cgi file a html extension
so visitors dont know its a cgi ...

i created a .htaccess file

AddHandler cgi-script .htm

now i have renamed the script.cgi to script.htm
and it works the script loads fine and has name script.htm

but now problem is all other htm files are giving a 501 error as the .htaccess says there scripts.

is there a extra line i can add to the .htaccess or other trickto run the script as htm and the htm files as plain htm pages?

Fischerlaender

8:45 pm on Apr 18, 2003 (gmt 0)

10+ Year Member



Your HTML files have the extension .htm, right? Why don't you just use
AddHandler cgi-script .html
?

You're the only one who knows that .html stands for CGI script and .htm for static page.

StopSpam

9:10 pm on Apr 18, 2003 (gmt 0)

10+ Year Member



that would solve it i know ...

but i can not name it html all files must be named htm
as other sites are aready linking to the htm pages

and one htm page i wish toreplace with a script

site links curently to page.htm
soon iwant toreplace page.htm for a cgi script named page.htm

but how can i keep other htm pages load as normal html source pages?

is there a sort adhandler that says only page.htm can wotk as cgi?

mavherick

9:41 pm on Apr 18, 2003 (gmt 0)

10+ Year Member



You could try the following in your htaccess file:
(Remove the AddType line and add these instead)

RewriteEngine On

RewriteRule ^page\.htm$ page.cgi [L]

Simply add more RewriteRules for pages that need to be executed as scripts.

Like

RewriteRule ^script\.htm$ script.cgi [L]

mavherick

StopSpam

9:59 pm on Apr 18, 2003 (gmt 0)

10+ Year Member



Cool thx mavherick

The capabilties of htaccess files are justendless and powerfull ;-)

i love it ...

if i do like you discribe will people thensee the file name get changed to page.cgi or will stay page.htm?

mavherick

10:43 pm on Apr 18, 2003 (gmt 0)

10+ Year Member



It will stay page.htm

mavherick

Fischerlaender

8:39 am on Apr 19, 2003 (gmt 0)

10+ Year Member



The capabilties of htaccess files are justendless and powerfull

.htaccess is only the place to configure your webserver. The capabilities here are provided by the mod_rewrite module. To use this capabilities, mod_rewrite must be installed on your server; on virtual server accounts it is very often not installed, because it costs some CPU time.