0

Hi there,

I need some help, I am building a large site, about 150 pages. I want the ending to be .html and not .shtml using .ssi. Is there a work a round to do this?

More information:
I am setting up a site for a client, and over the year the name of the items will chnage but the overall site will stay the same. So I thought why not use SSI for the menues along the top and down the side of the page, thsse could then be changed by a single .html page containing the menu information and would save me putting up the whole site each time there is a change. The problem I have is I don't want to use .shtml if I can help it. I have tested the server we use for web sites and the <!--#include file="/includes/navigation.ssi" --> works on .shtml but not on .html. On the internet people talk about .htaccess file helping with this problem, but I can't seem to get it working.

Any advice and working code would be very handy and helpful, and thanks for taking the time to read this post over the weekend.

kind regards

John

4
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by TLCJohn
0

Well, the fact of the matter is even if you did use an .htaccess file to tell the web server to treat .html as shtml, it will still cause a performance hit to all .html pages since it will need to pre-parse the files to look for special codes. I wouldn't recommend this because it will slow down any .html files that don't even have special coding.

Anyhow, the only thing I can really thing of that would allow you to use .html files but still keep the menu in a single place which would effect all the pages would be to use AJAX, and upon loading the page have an AJAX request load up the menu HTML.

For example, at the top of all your .html files, add something like this:

<div id='myMenu'></div>

Then in all of the pages, in the head area, have some JAVASCRIPT code that loads the menu HTML through an AJAX request and put it in the "myMenu" element.

Suppose you use jQuery (if you don't, check it out; it's really easy to learn and use, and I you can even use this code for your menu).. you could write this in your head tag:

<script type='text/javascript'>
$(function()
	{
	$('#myMenu').load('myMenu.html');
	});
</script>

Doing that would tell your pages: when it has loaded, load "myMenu.html" and take the HTML from there and put it in your element with the ID "myMenu".

That's the best thing I can think of.

0

part of a very much larger .htaccess file, .htaccess==goldmine

AddHandler server-parsed .html
Options +Includes

<Files .htaccess>
order allow,deny
deny from all
</Files>

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !www.mysite.com [NC]
RewriteRule \.(jpe?g|gif|bmp|png|wmv|asf)$ /images/nohotlink.jpg [F,NC]

ErrorDocument 404 /notfound.php
ErrorDocument 401 /needpassword.php
ErrorDocument 500 /noserver.php

<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType text/html "access plus 2 days" 
ExpiresByType image/gif "access plus 60 days"
ExpiresByType image/jpg "access plus 60 days"
ExpiresByType image/png "access plus 60 days" 
ExpiresByType application/x-javascript "access plus 60 days"
ExpiresByType text/css "access plus 60 days"
ExpiresByType image/x-icon "access plus 360 days"
</IfModule>

in order::
allows includes in html
stops outsiders reading .htaccess
blocks most image thieves
custom errormessage handlers
puts a default date on filetypes for spiders and browser cache

.htaccess server parsed files adds neglible time to serving the file, the file is only read once, not twice as previously noted, .htaccess acts on apache web server layers, well below the html is served

but why? not show shtml as shtml, or modernize it at least to php or asp, all users are accustomed to seeing filetypes other than html, no web site is static any more
for only 150 pages,
thousands of php pages from database on each site and is less server load (more importantly far less disk space) than the static pages were,
new information loaded by AJAX that may only require 25 bytes, not 25KB for a new static pageanyhow small kudos for trying to get around what seems to be a very restrictive spec

Edited by almostbob: n/a

0

Hi All including almostbob

Thank you so much for your help, the code you have given me has worked and for that I would like to say once again "Thank You" and all the very best.

John

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.