Forum Moderators: coopster & phranque

Message Too Old, No Replies

<!--#exec cgi="/cgi-bin/header.cgi" -->

if your like me, a new commer, read on.

         

KG2RG

10:22 pm on Dec 30, 2001 (gmt 0)

10+ Year Member



I'm just learning how to capitalize off the benefits of using SSI. So, if your like me, a new commer, read on.

I would like to share a nice little free script with you called the header and footer script. This is nothing new for most experienced webmasters, But if you are reading this and don't know what I'm talking about, then you better keep on reading.

I started using this script about a week ago and its the greatest thing since sliced bread. Its a 1 page script with only 2 lines to be configured, the shebang #!/usr/bin/perl, and the full server path to the header TXT file that you will create /home/sites/site25/web/footer.txt.

The way it works, is, you create a txt file for your header and place it on your server with the rest of your html files. To create the header.txt, just copy and paste the header from your index page, assuming you are using a header in your index.html.

You will have to rename all your pages.html to pages.shtml. Its a pane, but it will pay off in the long run.

you will have to upload the script in ASCII, NOT binary. And for UNIX servers, you will have to chmod permissions to 755. That's owner read write & execute, group & other is read & execute only.

then, on all your pages.shtml, remove the header and put this <!--#exec cgi="/cgi-bin/header.cgi" --> in its place.

The footer is a separate script and runs the same. Its a very easy script to install. I have had to install some real hard script before, and it may be a small simple script, but it will be you favorite.

I have close to 100 pages on one of my sites and needed to terminate a page called page x. If I did not have this script, I would have had to go to all 100 pages to remove the link to page x, in both the header and footer. Instead, I just removed the link to page x, in the header.txt and the footer.txt.

It will also save you server disc space. A header and footer can be more then 1000 characters. lets just say its 1000 characters per page, times 100 pages. So you will only use 1000 character instead of 100,000. You will use 99,000 characters less. This is because the users browser, when it loads a page and it sees the <!--#exec cgi="/cgi-bin/header.cgi" --> , it executes the header script. The header script takes the header.txt and either the script or the browser writes it in the location where you put the <!--#exec cgi="/cgi-bin/header.cgi" -->

I hope I explained it correctly. I may have been a little off, but it works and its great!

The script if free and can be found anywhere. If you need a copy, or need help getting it going, just sticky mail me

Key_Master

10:30 pm on Dec 30, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



A security tip: :)

Change <!--#exec cgi="/cgi-bin/header.cgi" -->

to <!--#include virtual="/cgi-bin/header.cgi" -->

KG2RG

12:04 am on Dec 31, 2001 (gmt 0)

10+ Year Member



Hi Key_Master, thanks for the tip. I have not tried it yet, but I will.

What is the security risk that is compromised from the use of my example? The header and footer are unsecured data of no significant value.

The reason for my question is to fully understand the concept. Is it a security issue because errors can arise through use of that method, is it just good habit for one day when inclusion of sensitive data from the secured side of ones server, or is there another reason?

Thank you for your reply

Key_Master

1:12 am on Dec 31, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Using exec makes it possible for a hacker to execute potentially destructive commands within the HTML page itself. May not be a threat in your case but using it unnecessarily is a bad habit to get into. Include virtual is safer.

Here's a decent tutorial on SSI. Note that it is not necessary to rename each file with a SHTML extension on most servers.

[hostingmanual.net...]

CaptainKarl

1:45 am on Dec 31, 2001 (gmt 0)



[an error occurred while processing this directive]

Im made a file called footer.txt i set on root dir
and added <!--#include virtual="/cgi-bin/header.cgi" --> to the <head> of all my *.shtml pages

Key_Master

1:50 am on Dec 31, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



CaptainKarl,

You got the wrong filename in the SSI directive. Try:

<!--#include virtual="/path to/footer.txt" -->

With "path to" being the directory the footer.txt file is in.

CaptainKarl

2:07 am on Dec 31, 2001 (gmt 0)



Like this
<-------footer.txt------->
#!/usr/bin/perl
/home/maindomain/domainname/footer.txt

<--------Web page-------->
<html>

<head><!--#include virtual="/cgi-bin/header.cgi" -->

<title><edit - page title here></title>
</head>

(edited by: Marcia at 2:31 am (gmt) on Dec. 31, 2001)

Key_Master

2:41 am on Dec 31, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I may be missing something here but why the need for a header.cgi script?

<!--#include virtual="/path to/name_of_text_file.txt" --> would do the same thing without the need for scripting.

CaptainKarl

3:36 am on Dec 31, 2001 (gmt 0)



Could you elutriate like my post

file---------------------->

web page------------------>

KG2RG

7:26 am on Dec 31, 2001 (gmt 0)

10+ Year Member



it is not necessary to rename each file with a SHTML extension on most servers.

I also read this in a tutorial on SSI, but it told me that it may only work 80% to 90% of the time. So I just put a S in front of the html to be on the safe side.

CaptainKarl, If you look at my profile, and go to my non profit ham radio site, you will see what I mean when I say header. No matter what page you go to, the top is on every page. And so is the footer. I don't mean the stuff in the <head> tags, as you mentioned, although, you may be able to do that to. But I would want to customize every meta tag for every page.

A header is just something that can be seen by the viewer, on top of your page/pages. It can be a banner or just a picture. Just take it as the way you created it, HTML and all, and save it as a txt file.

Are you using a header script? Key_Master said we don't even have to use a script, I will try that 2.

Lets say you have a site with a navigational links bar on the right of the page. And no matter what page your on, the navigational links are always on the right.

<table><tr><td>left</td><td>center</td><td>links</td></tr></table>

Instead of putting that whole navigational links bar in the right table of every page, you just put it on a blank file, and save it as a txt file. Then put the tag that calls the txt file in the right table.

<table><tr><td>left</td><td>center</td><td><!--#exec cgi="/cgi-bin/footer.cgi" --> </td></tr></table>

This has nothing to do with this, but I'll add it anyway. Most designers put the link bar in the left table. I always put it in the right. Humans see it as left , center and right but search engines read it the way its wrote, top to bottom.

So left is really top, center is under left, in the middle and right is at the bottom. Links are not major keywords within your body. A search engine pays more attention to the text on the top of the page. If your site is about ham radio, and if the first words the SE comes across are the words "ham radio", them the SE thinks this site must be very relevant to ham radio. This is where you want to place your top keywords and phrases.
As the search engine reads through the page towards the bottom, it pays less attention to keywords here.. If I put the links bar on the left, the top that is, then it only pushes my top keywords and phrases towards the bottom.

Sorry about getting so far off track on that, Just wanted to ad that.