Welcome to WebmasterWorld Guest from 126.96.36.199
Forum Moderators: phranque
I have a dedicated unix server hosting approx. 50 domains. These domains have content along a general theme. There are roughly 10,000 pages ending in .htm, .html, and .shtml. Due to legacy issues with the SE's, I cannot change the extension of many of the existing .htm and .html files. Nor do I want to use .htaccess to globally declare these to be SSI enabled.
For over a year now, I've been using external .js files and absolute calls to inject navigation globally across any/all pages, regardless of the extension or the domain or subdirectory where the file is located.
I now want to inject ads and navigation using SSI and abandon external js, browser sniffing, etc.
First, the simplest question (I hope)... on files that are .shtml -
- How do I construct the text to be written into the files, or are they just .txt files?
- Where do I place these files, in the cgi-bin, or just set up a holding directory somewhere on the machine?
- How do I constuct the SSI call?
Now on to what, for me, seems the more complex issue -enabling the old .htm and .html files so that the SSI call will work.
Can I use .htaccess at the subdirectory level to declare every .htm file located within that subdirectory to be SSI-enabled? OR, do I have to do it for the whole domain, or even the whole machine?
AddType text/x-server-parsed-html .html
AddType text/x-server-parsed-html .htm
to my .htaccess file. Not sure how to do it/if it's possible for subdirectory level.
I have also seen the following, but haven't used it:
AddHandler server-parsed .html .htm .shtml
To make the SSI call, just put:
<!--#include file="file.html" -->
where you want the include to go. The files can be .txt or .html and are just plain code, nothing special needed. This is for the include to be in the same dir as the calling page.
To use include files stored elsewhere, use:
<!--#include virtual="/path/to/your/file.html" -->
Be sure to leave a space after the last " before the "-->"
To enable every .htm and/or .html file in a directory AND in subdirectories below it:
chmod -R u+x *.htm*
To enable every .htm and/or .html file in only the current directory or subdirectory:
chmod u+x *.htm*
To specify individual file(s) in only the current directory or subdirectory:
chmod u+x filename01.htm filename02.html filename03.htm
(I think I listed this correctly, let me know if there are any errors.)
The server guys were also outlining a way to set up a single master listing (in a .txt file) of enabled individual files in the root ...they were jabbering something about backticks and full paths. I'll explore that later perhaps.
Edited by: rcjordan
To keep cpu load down by listing the exact file, and to make this more easily manageable from a single central location, I'm going to try the above. The server guys are setting it up. The only negative is that I'll need to have the server run an update every time I add a file. I could have them set it up in the cron, but once I get this list built I don't think there will be many additions.
I'm setting up a free hosting site. Basically I need to add a header and footer on every .htm .html page that is created in their directory.
Can I accomplish this with Win2k IIS 5.0 ?
Thanks in advance,
On NT you won't have to worry about the permissions, but changing the extension association is an 'administrative' job. I'm sure Xoc could do a good outline for you.
Welcome to WMW. To allow scripts to run on IIS for .htm pages or any other extensions:
To configure IIS to process .htm files allowing scripts:
1 Start up Internet Service Manager
2 Select the web site you want to do the processing on
3 Right click on it and select Properties
4 Select Home Directory
5 If necessary, create an application
6 Press Configuration
7 Select .asp and press Edit
8 Copy down the information in the dialog
9 Press Cancel
10 Press Add
11 Use the file extension .htm, use all the other information that you copied down in step 8
12 Press OK to all the dialogs
13 Restart IIS for good measure
If you don't have access to the web server, you will have to get friendly with your ISP to make this change.
I'm planning on running a free hosting website. Webmasters can upload htm/html pages to the server. There is no way I can manually had a header and footer using the "include" command.
Any idea on how to add the include to all htm pages that are served within a directory?
1. Using .htaccess to direct all hits to the directory to the same "shell page"
2. The shell page could contain the header and 2 include directives
3. The first include runs a script to identify/display the requested page.
4. The second include displays the footer
I would personally do a search on free NT hosting, take space at a couple, try to garner a few clues as to how they're doing it, and probably ask tech support a few "dumb questions" (I learn a lot that way);)
I assume you want to include ad banners for yourself, and include a text link to your main site for the free hosting. I've seen a couple of free sites use an iframe for their ads - not a clue how they implement this, though.
I do happen to know that webjump.com offers free NT hosting - they use a top frame, and all of their sites display with their frame on top. You might want to check out how they're doing it. Also, there are some free web space providers who will work cooperative ventures with webmasters who want to offer free space, and the sites run on their servers.
No offense, but I learned a good deal more by rolling up my sleeves and digging in, doing the research and studing, then by asking questions and expecting others to solve all of my problems. Perhaps it's time to go learn a bit more about NT? :)
Marcia offered some good advice, ask the people who operate an NT server, they are most famialiar with what it can do...
1. Select the directory, right click on it, then select "properties".
2. In the dialog, select the "Home Directory" tab.
3. Click on "A redirection to a URL"
Then read the help on how you can configure the URL...you have a fair amount of flexibility on how you do it.
First, it only works in .htm pages, not .asp pages.
Secondly, you have to change a registry setting in IIS 5.0 before it works. In IIS 4.0, you the default is enabled.
The key is HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W3SVC\Parameters\ SSIEnableCmdDirective = 1
See http://www.microsoft.com/ windows2000/en/server/iis/ default.asp?url=/WINDOWS2000/en/server/iis/htm/core/iiregwww.htm [microsoft.com] for more details.