Using SSI's to Ease Site Maintenance

Written by Lauri Harpf


Continued from page 1

Fortunately, there's no need to start renaming any files. You can simply instructrepparttar server to treat your ".html" files as ".shtml" files and execute all SSI instructions in them. This can be done with a ".htaccess" file. If you already have one, you'll have to edit it. If you don't, open up a text editor, such as Notepad, and pasterepparttar 134572 following lines into a blank file. Be sure to replace .html with .htm, if you're using that extension.

Options Includes AddType text/html .html AddHandler server-parsed .html

Saverepparttar 134573 file in "All files" mode and name it ".htaccess". Includerepparttar 134574 quotes so that Notepad won't decide to namerepparttar 134575 file ".htaccess.txt".

Changing Your Pages ===================

Afterrepparttar 134576 .htaccess file has been created, you'll have to make changes to your HTML files. To be onrepparttar 134577 safe side, take backups of them before doing anything. Then, pasterepparttar 134578 HTML you use to generaterepparttar 134579 menu from one of your pages into a blank file. Saverepparttar 134580 file as "navig.html" for example. Next, removerepparttar 134581 navigation menu from all of your pages. Replace it withrepparttar 134582 following line:

What you're doing is tellingrepparttar 134583 server to insertrepparttar 134584 code from "navig.html" intorepparttar 134585 page. This will be done beforerepparttar 134586 page is sent torepparttar 134587 user who has requested it, so anyone visiting your site will merely see a normal HTML file. When you have finished editing your files, connect to your host via FTP and uploadrepparttar 134588 ".htaccess" file,repparttar 134589 "navig.html" file andrepparttar 134590 new versions of your content pages.

Then it is time forrepparttar 134591 true test, trying to visit your site and see what happens. If you have done everything correctly, you should see that your pages lookrepparttar 134592 same as before. However, if you make a simple change torepparttar 134593 "navig.html" file, it will apply torepparttar 134594 navigation menu of every page. What used to take minutes or even hours can now be done in seconds, giving yourepparttar 134595 possibility to use that valuable time to do something other than changingrepparttar 134596 HTML code of each page separately.

Lauri Harpf runs the A Promotion Guide website, where he offers free information about search engines, directories and other promotion methods. His site can be found at http://www.apromotionguide.com/


Advanced 404 Pages

Written by Lauri Harpf


Continued from page 1

You're now done withrepparttar CGI script. Save it as "404helper.cgi", withoutrepparttar 134571 quotes of course. However, there's still work to be done, so take a deep breath and prepare yourself forrepparttar 134572 next challenge.

Editing your custom 404 page and .htaccess file ===============================================

Just havingrepparttar 134573 script will not be enough. In order for it to work, it has to be executed when an error is encountered. This isrepparttar 134574 part whererepparttar 134575 SSI's step intorepparttar 134576 picture. Open up your 404 error page in a text editor and addrepparttar 134577 following line into it:

Becauserepparttar 134578 script prints out a few rows of HTML after it has been run,repparttar 134579 best place for that line is atrepparttar 134580 bottom of your 404 error page, but beforerepparttar 134581 tag. After everything is safely in place, simply saverepparttar 134582 file, but instead of ending it withrepparttar 134583 usual ".htm" or ".html", use ".shtml". Do not forget to do this, asrepparttar 134584 SSI tag might not work if you fail to userepparttar 134585 proper extension.

Finally, you will have to editrepparttar 134586 .htaccess file you created when you built your custom 404 page. If you only have " ErrorDocument 404 http://www.yourdomain.com/404page.html " in it, modifyrepparttar 134587 file so that it will containrepparttar 134588 following:

Options Includes ExecCGI AddType application/x-httpd-cgi .cgi .pl AddType text/html .shtml AddHandler server-parsed .shtml ErrorDocument 404 http://www.yourdomain.com/404page.shtml

The new lines will enable Server Side Includes and CGI so that your script will work. Do not forget to changerepparttar 134589 ErrorDocument 404 line to point torepparttar 134590 new .shtml page instead of your old .html version. After you are done, save your .htaccess file.

Upload, set permissions and launch! ===================================

Connect to your host with an FTP program and uploadrepparttar 134591 .shtml version of your 404 page and your new .htaccess file into your root directory. Then go torepparttar 134592 directory you've reserved for CGI programs and sendrepparttar 134593 404helper.cgi file there. Make sure that you upload in ASCII, not in Binary mode! I nearly drove myself crazy by accidentally using Binary mode and then trying to figure out whyrepparttar 134594 script refused to work.

Everything is now uploaded and all that remains is to set permissions so thatrepparttar 134595 CGI program can be executed. You'll need to CHMOD 755 bothrepparttar 134596 CGI file andrepparttar 134597 directory where it is in. The steps you need to take in order to accomplish this depend on what software you are using, but here arerepparttar 134598 instructions on how to do so with WS_FTP, a popular Windows FTP program which can be downloaded from Tucows.com.

First, navigate torepparttar 134599 directory where you've uploadedrepparttar 134600 CGI program. Left-click it once to highlightrepparttar 134601 file, then right- click it. Select "chmod (Unix)" fromrepparttar 134602 menu that appears. Give Read, Write and Execute permissions torepparttar 134603 Owner and Read and Execute permissions to Group and Other. Then go intorepparttar 134604 root directory and repeatrepparttar 134605 same process withrepparttar 134606 folder ofrepparttar 134607 directory where you placedrepparttar 134608 CGI program.

That's it. The work is finally done and you can now enjoyrepparttar 134609 luxury of receiving an E-mail report on all 404 errors, allowing you to quickly stomp out any broken links and improverepparttar 134610 quality of your site. Congratulations!

Lauri Harpf runs the A Promotion Guide website, where he offers free information about search engines, directories and other promotion methods. His site can be found at http://www.apromotionguide.com/


    <Back to Page 1
 
ImproveHomeLife.com © 2005
Terms of Use