Site Management
-Folder Redirection
Apache’s a fantastic web server platform, and using a site editing package like RapidWeaver or iWeb will let you get the look and feel right. The down side to this is that you will probably encounter some problems if your site has been up and running for a while. Chances are your directory structure will change following site redesigns, yet the old page will be indexed in search engine databases.
There are many ways to redirect content, but the simplest one I’ve used consists of using the Redirect directive. Here’s the syntax required:
Redirect /path to directory http://url to redirect to
Ex: Redirect /projects/PFSense http://www.digitalphotomac.com/PFsense
I am actually using the above example to do an automatic redirection from the old structure to the new structure. When someone calls up:
http://www.digitalphotomac.com/projects/PFSense
it is automatically redirected to the location of the newer files.
http://www.digitalphotomac.com/PFSense/
Note: this requires that the source directory structure exists. If you have erased it, you need to recreate it. The destination URL can be anything. Here is an example containing the Redirect directives for two directories, stored within a VirtualHost definition:
# ServerAdmin admin@somedomain.com
# DocumentRoot /var/www/somedomain
# ServerName www.somedomain.com
# Redirect /guides/samples http://www.somedomain.com/samples
# Redirect /guides/servers http://www.somedomain.com/datacenter
Note that I included the paths without trailing slashes. I have taken the habit of naming the first page in all my sub-directories index.html, which means visitors can use shorter URLs. Also, remember to uncomment the lines to enable the change, and check your syntax using apachectl -t before restarting apache.