Archive for December 8th, 2004
Using .htaccess to improve the user experience for a website running on an Apache server
A few weeks back, I updated two websites (which run on my ISPs’ Apache servers) to use various features which improve the experience for users of the site. These features include:
Server side includes (SSI).
Changing the default web page.
Providing custom error messages.
Redirecting clients where pages have changed.
Preventing listing the contents of certain directories.
Denying access to certain [...]
Posted: December 8th, 2004 under Apache, IIS, Website development.
Comments: none
Using server side includes in web pages
One of the features used in my website is server side includes (SSI). The SSI code allows my sites to include dynamic information which would otherwise require scripting that may not function correctly with certain browsers.
SSI is pretty simple. Apache users need to edit the .htaccess file in their web root directory to allow SSI, [...]
Posted: December 8th, 2004 under Apache, IIS, Website development.
Comments: 1
Implementing custom error pages for a website
One of the features used in my website is custom error pages, which allow errors to be handled using a format that matches other documents on the site.
Apache users can configure custom error messages using .htaccess. Once pages have been created for an error message, include a directive in the .htaccess file as follows:
ErrorDocument error-code [...]
Posted: December 8th, 2004 under Apache, IIS, Website development.
Comments: 3
Changing the default documents for a website
My ISPs’ Apache servers are configured for index.html and index.htm to be the default documents; however since implementing server side includes in my websites I need index.shtml to be recognised as the default document.
Fortunately, this can be achieved using the following directive in the corresponding .htaccess file:
DirectoryIndex index.shtml index.html index.htm
Microsoft Internet Information Server (IIS) users [...]
Posted: December 8th, 2004 under Apache, IIS, Website development.
Comments: none
Redirecting clients when websites change
Whilst looking at the website statistics for my main website, I realised that many users were attempting to access pages that no longer exist on the server. Some may argue that old content should be left in place, but others will disagree and my preferred approach is to redirect requests to the new locations, or [...]
Posted: December 8th, 2004 under Apache, IIS, Website development.
Comments: 1
Preventing listing the contents of a directory on an Apache web server
When no default document is found on a web server, depending on the server configuration, users may be able to list the files in a given directory. For Apache servers, this may be prevented on a per-directory basis by adding add an IndexIgnore directive to an .htaccess file.
The syntax is:
IndexIgnore file [file] ...
For example, IndexIgnore [...]
Posted: December 8th, 2004 under Apache, Website development.
Comments: none
Denying access to certain files on an Apache web server
Under certain circumstances, it may be necessary to deny users access to various files on a web server.
For example, some directives in an Apache .htaccess file may be considered a security risk and so access to the file may be prevented using the following directives:
<files .htaccess>
order deny,allow
deny from all
</files>
The first line limits the directive to [...]
Posted: December 8th, 2004 under Apache, Website development.
Comments: 3


