Forum Moderators: phranque

Message Too Old, No Replies

Using SSI on Index page

I don't want to hurt myself

         

kanetrain

7:35 pm on Jul 15, 2003 (gmt 0)

10+ Year Member



I am currently working on a redesign of my site. On the front page I would like to use server side includes to bring in some dynamic content.
Here is my problem: My front page is currently a .htm page and in order to use ssi you have to change the suffix to .shtml. I guess the question is this... will that index page get picked up automatically by Google, All the Web, Inktomi and Alta Vista? Or will I get dropped if I delete my current homepage and replace it with the .shtml page. Does anyone know what will be the ramifications of changin the suffix.
I'm not sure it's worth the risk, if there is a risk. I am already ranking very well for my keywords and I don't really want to jeopardize that.
Any help would be greatly appreciated.
Thanks!

mivox

7:46 pm on Jul 15, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Do you have access to your .htaccess file? If you don't already have one, make sure you can create/use one... just a plain text file, saved with the file name .htaccess and uploaded as plain text to the same directory as your site's index page.

Just add this line to the existing .htaccess file, or create a plain text file with this line in it:

AddHandler server-parsed .html .htm .shtml

That will tell your server to treat .html and .htm pages the same as .shtml pages, and you can use SSI on any page, without worrying about changing your suffixes!

(Test it to make sure your host has given you the ability to use the AddHandler function at your account level...)

TGecho

2:00 am on Jul 16, 2003 (gmt 0)

10+ Year Member



While you're at it, you might think about using SSI to splice in headers, footers, and the like.

kanetrain

5:34 am on Jul 16, 2003 (gmt 0)

10+ Year Member



Thank you sooooo much. I love this place.
That little tidbit of info just saved me so much time and effort and headache. Did I mention thanks?!

jdMorgan

6:42 am on Jul 16, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



kanetrain,

However, on those pages where *all* you include is headers and footers - basically pages with no real dynamic content - you might want to use the XBitHack Ffull option as well. This will cause the html page to "keep" it's own Last-Modified date and send it in the http response header. Otherwise it gets dropped, because Apache can't otherwise be sure which Last-Modified date to return; that of the html page or that of one of the included files.

You do NOT want to use this mechanism on your pages with truly-dynamic content, though.

It's explained better in the Apache mod_include documentation. :)

Jim

jamie

7:15 am on Jul 16, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



kanetrain,

just wanted to second what jdmorgan said. if you don't do xbithack then none of your pages are cacheable which is bad for your bandwidth and your users' download times.

check web-caching.com - an invaluable resource.

kanetrain

7:00 am on Jul 17, 2003 (gmt 0)

10+ Year Member



Thanks for the pointers... so is there any way for me to specify that I just want one page (my index page) to be read as .shtml when it is really just a .html page?
I've got my .htaccess file up right now with this:
AddHandler server-parsed .html .htm .shtml

and it's located in my htdocs folder. It's working right now. I need it to work for my index page... and I don't need it to work for any other page on my server.

It's just used to bring in one image to the index page of my site. I couldn't care less about the rest of my pages. The rest of my site (almost every page) is dynmaic (.php).

Thanks for all of the great advice. Should I just keep the addhandler code on that .htaccess file in my htdocs folder and then upload blank htdocs files to the rest of the my directories (the ones that contain my php scripts etc.)?

Any help would be greatly appreciated. Thanks!

kanetrain

8:02 am on Jul 17, 2003 (gmt 0)

10+ Year Member



I found another workaround. You can add the following to the .htaccess file and it will ONLY parse the pages that you tell it to parse:

Options +Includes
XBitHack on

You just change the permissions chmod to 755 for these pages and then the .htm
pages with chmod chaged to 755 are parsed as if they are .shtml pages.

The cool thing about this is that it ONLY parses those pages that you want.

You should not include the AddHandler server-parsed .html .htm .shtml

code if you are using the xbithack code. The xbithack code alone does the trick.

Thanks for all your help. Does anyone know of any security issues using the xbithack. I don't think there are, but I wanted to check and make sure.