Enabling SSI without .shtml

Discussion in 'Site & Server Administration' started by manov, Aug 3, 2006.

  1. #1
    Hello friends,

    I've an established website. All the files have .html extension.

    Now I want to enable SSI (server side includes) because this site contains too many pages and updating is painful task.

    My website is hosted on Apache server. SSI works if I give .shtml extension to my files. Since this is an established website I can’t change the file name to .shatml

    I heard that SSI function can be enabled even without .shtml file extension.

    Please help me

    Thanks :)
    Mahesh
     
    manov, Aug 3, 2006 IP
  2. dcristo

    dcristo Illustrious Member

    Messages:
    19,776
    Likes Received:
    1,200
    Best Answers:
    7
    Trophy Points:
    470
    Articles:
    7
    #2
    From my understanding it's not possible. A workaround would be to add a line in your .htaccess to read PHP code on html pages, so then you can just use PHP includes and achieve the same thing.
     
    dcristo, Aug 3, 2006 IP
  3. vagrant

    vagrant Peon

    Messages:
    2,284
    Likes Received:
    181
    Best Answers:
    0
    Trophy Points:
    0
    #3
    i use this in my .htaccess file and it does the job for me so far

     
    vagrant, Aug 3, 2006 IP
  4. hans

    hans Well-Known Member

    Messages:
    2,923
    Likes Received:
    126
    Best Answers:
    1
    Trophy Points:
    173
    #4
    from my own direct experience it works - my host had SSI enabled for all .*htm* extensions - hence also NON-shtml and I used it successfully for years until months ago when i switched to PHP included site-wide

    it normally should work with the following 2 lines in your

    .htaccess

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

    IF however later you want to use PHP includes THEN either site-wide OR in that particular subfolder you would have to REMOVE the a.m. handler again
     
    hans, Aug 3, 2006 IP
  5. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #5
    It is a not particularly good idea to parse all files as SSI. It just puts extra load on the server.

    If you are not able/willing to convert file names to the shtml extension, use the XBitHack. With XBitHack on, either in httpd.conf or in an .htaccess file, you need only chmod +x filename for each file that actually has includes. Only those .html files with the x-bit set will be server parsed.

    cheers,

    gary
     
    kk5st, Aug 3, 2006 IP
  6. dcristo

    dcristo Illustrious Member

    Messages:
    19,776
    Likes Received:
    1,200
    Best Answers:
    7
    Trophy Points:
    470
    Articles:
    7
    #6
    I've heard others say this as well with parsing PHP. I never noticed any considerable difference in load times though.
     
    dcristo, Aug 3, 2006 IP
  7. jfkelley

    jfkelley Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Ok, I'm a newbie and I am afraid of files that start with a dot (e.g., .htaccess).

    Happily, I found a widget on my hosting company's CPANEL admin page called Apache Handlers

    I just added a handler:
    server-parsed .html

    Ba-da-bing.

    Of course, I know I have added a performance hit. Someday I might re-investigate that bithack thing mentioned above.

    SSI is just too much of a productivity gain for me to give it up.
     
    jfkelley, Dec 3, 2008 IP