Tuesday 6 November 2012

Apache Alias's to the rescue!

15.19pm.Are you are looking to consolidate multiple web-roots into one, but want to ensure that the old URLs are still active and function as required? If so Apache Alias's are your friend. With a single command in a vhost or httpd.conf you can transparently redirect a user to a new location.
Alias /MyFirstWebsite/images/profilePhotos /var/www/mySecondWebsite.com/images/betterProfilePhotos 
I put this above any <Location> or <Directory> statements, but below the DocumentRoot,ServerName, and ServerAlias directives.

It is important to always test these changes with an apache/httpd reload rather than a restart to minimise downtime if a config error has occurred.

NB: All required files should also be in the new web-root and have the same name, if not you will receive a 404.

No comments:

Post a Comment