How to make HTML page that uses SSI?

Discussion in 'HTML & Website Design' started by SFNUM8, Jan 22, 2009.

  1. #1
    I have a site that I designed where all the pages are html, it started out real small, where I could easily go to each individual page and update menus, but now has a decent amount of pages, too many to update. I now would like to re-design the site using SSI to upadate menus on everypage with only 1 edit. I know how to do this in PHP but this site already is established and has links pointing back to .html pages. So my question is how do I design this site so that all of the pages remain .html but allow me to do SSI as well.
    If you have a link to a good tutorial I would love to have that as well. Any help is appreciated.
    Thanks
     
    SFNUM8, Jan 22, 2009 IP
  2. eric.r

    eric.r Peon

    Messages:
    124
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Not sure on this. I had a discussion with my friend in school about this subject. I think you use the .htaccess file so you can rewrite the url so it still has a .html or .htm extension. Hope this helps

    ~eric
     
    eric.r, Jan 22, 2009 IP
  3. Colbyt

    Colbyt Notable Member

    Messages:
    3,224
    Likes Received:
    185
    Best Answers:
    0
    Trophy Points:
    210
    #3
    SSi is pretty limited and will require your page to be renamed.

    If your server has php you can add a handler to the .htaccess file to parse html pages as php. You can then use php includes to include as many parts as you want and you do not lose any back-links as your pages retain the html extension.

    On most of my sites I have one header, footer, navigation and ads page included in all the other pages. An example page with more details.

    Ask any follow-up questions in this thread and I will try to answer.
     
    Colbyt, Jan 23, 2009 IP
  4. eric.r

    eric.r Peon

    Messages:
    124
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4
    So its basically exactly what I said...
     
    eric.r, Jan 23, 2009 IP
  5. Colbyt

    Colbyt Notable Member

    Messages:
    3,224
    Likes Received:
    185
    Best Answers:
    0
    Trophy Points:
    210
    #5
    The result is what you said but it is not a rewrite funtion. What you are doing is telling Apache that html pages are to be treated as if they are php.

    The actual code that does it is:

    AddHandler application/x-httpd-php .html
    PHP:
     
    Colbyt, Jan 23, 2009 IP
  6. Corey Bryant

    Corey Bryant Texan at Heart

    Messages:
    1,126
    Likes Received:
    51
    Best Answers:
    0
    Trophy Points:
    0
  7. eric.r

    eric.r Peon

    Messages:
    124
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Is that what is in .htaccess? Only that code? I have never done much with htaccess before.
     
    eric.r, Jan 23, 2009 IP
  8. Colbyt

    Colbyt Notable Member

    Messages:
    3,224
    Likes Received:
    185
    Best Answers:
    0
    Trophy Points:
    210
    #8
    That is all it takes to parse html pages like they are php.

    A lot of sites don't even have a .htaccess file. There are a lot of other things that might be put in one like:
    301 and 302 redirects
    mod rewrite functions
    allow deny commands to ban ips or countries.

    On many systems you can control certain aspects of PHP if override_allowed is set to on in the master config file.
    Stuff like register_globals off on, memory and post sizes etc.
     
    Colbyt, Jan 23, 2009 IP
  9. plugandplay

    plugandplay Peon

    Messages:
    51
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    As Colbyt says you just need to change your .htaccess file to something like
    check with your host though and let them know what you want to do as some servers need
    , but some need
    and hosts also have different verions of php on them.

    after your server is set to allow your html pages to work with php you can make calls to your SSI pages, the code for that is
    (or .html or .php whatever the extension)
     
    plugandplay, Jan 23, 2009 IP
  10. eric.r

    eric.r Peon

    Messages:
    124
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #10
    If shorttags are turned off then that code is completely useless :) Just do <?php instead.

    ~eric
     
    eric.r, Jan 23, 2009 IP