Forum Moderators: phranque

Message Too Old, No Replies

SSI without changing extention

         

ganderla

3:55 pm on Mar 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I would love to use server side includes on my site for navigation and such. My hoster says that I must change all my file extetions to .shtml. This will make me lose my PR and it is a huge hassle. Is there a way to treat a .html page like a .shtml page without changing the extention?

Thank you

birdstuff

6:27 pm on Mar 23, 2004 (gmt 0)

10+ Year Member



Add this to your .htaccess file:

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

Now you'll be able to use SSI on your .html pages.

ganderla

7:08 pm on Mar 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well, I tried that and when the page loaded, there was an "error while processing this directive"

jdMorgan

9:27 pm on Mar 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



ganderla,

Good! - That means SSI is active. It also means (unfortunately) that your SSI code has a problem. But it is being included now, so you're making progress.

Jim

ganderla

9:38 pm on Mar 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I figured it out. I was doing the testing on ht*tp://www.mysite.com/folder/page.html

Each folder has its own .htaccess file AND the file I was trying to include was in a different folder.

Wow, I can not tell everyone how great it is when changing one item in a navigation menu, how easy it is to do it once and not 5,000 times.

EBear

5:53 pm on Mar 24, 2004 (gmt 0)

10+ Year Member



ganderla,

Without wishing to confuse you further, another way is to put the following into your .htaccess file:

Options +Includes
XBitHack on

This tells the server to parse all executable files for SSI directives. The advantage to this approach comes if you have any html files that do not use SSI (for example, if your index page is a splash page or of a different format to the rest of the site). Then you do not have to set them as executable and they will be served faster by the server.

To make a file executable perform a CHMOD 755 on it. To do this in WS_FTP select the file (or files), right click on it, choose CHMOD and tick the boxes as follows:

Owner Group Other
Read Read Read
Write - -
Execute Execute Execute

You're right about the maintenance ease of SSI. Do a search also for conditional SSI. It's great for simple "dynamic" content, such as including a seasonal piece in your page or passing simple arguments in the query string.