homepage Welcome to WebmasterWorld Guest from 54.204.128.190
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Making .htm file run like .shtml
skuba




msg:1504284
 3:03 am on Feb 23, 2004 (gmt 0)

Hi,
I would like to know how would be the rule to make .htm and .html files run on the server like shtml.
I need to use some includes and I can't go throught the whole site renaming files and fixing links.

I also need to know how to set a rule to send every request to www.mydomain.com/-/ to www.mydomain.com .

Thanks a lot for helping.

 

keyplyr




msg:1504285
 5:14 am on Feb 23, 2004 (gmt 0)

For the 1st question, try adding this to .htaccess:

AddType text/x-server-parsed-html .html

However, your host is the best place to get this info since it depends on how they have the server configured.

Marcia




msg:1504286
 5:45 am on Feb 23, 2004 (gmt 0)

There's a good SSI tutorial in the official Apache documentation

[httpd.apache.org...]

skuba




msg:1504287
 4:24 am on Feb 24, 2004 (gmt 0)

I tried like this and didn't work.
Options +Includes
AddType text/x-server-parsed-html .htm
AddType text/html .htm
AddHandler server-parsed .htm

I think there is something missing?

Thanks

jdMorgan




msg:1504288
 4:42 am on Feb 24, 2004 (gmt 0)

From the link Marcia provided: [httpd.apache.org...]

You said you wanted to parse .htm and .html for SSI, but the code you posted only enables .htm parsing.

Jim

skuba




msg:1504289
 5:15 am on Feb 24, 2004 (gmt 0)

Yes, but for now I started testing only with .htm
and it's not working.
I am getting [an error occurred while processing this directive] .
I guess there is something missing.
Thanks

jdMorgan




msg:1504290
 5:29 am on Feb 24, 2004 (gmt 0)

That message is the standard error message for SSI code errors - Which means that you have successfully activated SSI, but one of the SSI directives on your page has a bug.

If you have SSI-included files that themselves include other SSI, make sure those filetypes are also being parsed for SSI - That's one of the easier ways to cause this problem. For example if you use SSI to include a file called footer.std, and footer.std uses SSI to add "This page last modified" and the Last-modified date to your footer, then you'll have to enable SSI parsing for filetype ".std".

Jim

skuba




msg:1504291
 5:06 pm on Feb 24, 2004 (gmt 0)

Jim, thanks for helping.
But I still don't have it working. Let me explain.
The file is a basic .htm file with some text in it. It has a include to another .htm with just 1 word in it, no more SSI.
When I put the file on the web and try to run, I get the error. But if I save the same file as .shtml and run, it works.
That's why I think there is something missing, it's like the .htm is not being completed parsed. I don't think is a problem with the code or the .shtml wouldn't work too.
Right?
Thanks again

skuba




msg:1504292
 7:30 pm on Feb 24, 2004 (gmt 0)

This should be a simple rule but is not working.
Could anybody else help?
Thanks

skuba




msg:1504293
 7:43 pm on Feb 24, 2004 (gmt 0)

You know what?
I guess it only works for .html but not for .htm
at least for me
with rule
AddType text/html .html
AddHandler server-parsed .html

I can make the .html be parsed fine

but with rule

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

I can't!

Anybody knows why?

Marcia




msg:1504294
 7:46 pm on Feb 24, 2004 (gmt 0)

skuba, I've got it working with just this in .htaccess

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

I've had it working with a .txt file included, but this time with the host where I'm using it, it had to be an .html extension (or .htm - same thing) to get it to work. I used leftnav.html for the left navigation part - works fine.

Watch about the location of the page relative to the page where the included file will be; I find that the hardest part and sometimes end up putting the include in the same /folder/ to keep things uncomplicated for myself.

It did not work with /include.html in the root, it did work without the forward slash - include.html.

Added:

Try using both of them, with separate entries and see what happens

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

and

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

I realize there might be better or shorter ways, but I try to idiot-proof everything for myself. :)

skuba




msg:1504295
 8:11 pm on Feb 24, 2004 (gmt 0)

I know what you mean. But see, it has nothing to do with where the included file is , or the linking , etc...Because it works for the html file. It just doesn't work for the .htm.
So, the problem is related to the parsing of the file.

skuba




msg:1504296
 1:44 am on Feb 25, 2004 (gmt 0)

Anybody else could help getting my .htm files parsed?
I've been trying like crazy.
Thanks a lot.

jdMorgan




msg:1504297
 1:48 am on Feb 25, 2004 (gmt 0)

See mod_include [httpd.apache.org], and XBitHack.

Jim

skuba




msg:1504298
 10:29 pm on Feb 26, 2004 (gmt 0)

It finally work with that

Options +Includes
XBitHack on
AddType text/html .htm
AddHandler server-parsed .htm

thanks

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved