Use Alias and Apache to Create Custom Mappings
I really love the flexibility Apache gives you when setting up virtual hosts. Another benefit is the Alias directive.
I've worked on a few concepts recently that I want to demo as a sample app. After a few revisions, I finally settled on a folder structure and Alias name setup I felt would secure my component classes and facilitate mappings to frameworks and shared libraries.
Here is the folder structure (note that application names are obfuscated to protect the innocent):
/apps/appName
/apps/appName/config
/apps/appName/controller
/apps/appName/layout
/apps/appName/model
/apps/appName/root
/apps/appName/view
/coldspring
/lightwire
/com
Here is the Apache virtual host configuration (somewahat abridged):
DocumentRoot "/path/to/apps/appName/root"
ServerName appName.fancybread.com
DirectoryIndex index.cfm
ErrorLog logs/appName-error_log
CustomLog logs/appName-access_log common
# application alias settings
Alias /config "/path/to/apps/appName/config"
Alias /controller "/path/to/apps/appName/controller"
Alias /layout "/path/to/apps/appName/layout"
Alias /model "/path/to/apps/appName/model"
Alias /view "/path/to/apps/appName/view"
# framework and shared library mappings
Alias /lightwire "/path/to/lightwire"
Alias /coldspring "/path/to/coldspring"
Alias /com "/path/to/com"
Alias /lib "/path/to/lib"
</VirtualHost>
As you can see, using Alias within the virtual host setting provides the flexibility reconfigure applications with a change to the mapped path. So for cats who still prefer to type their objects, as I do, this is a blessing.
I work in a mixed environment where the production server is IIS and dev is Apache. I hope I can create the same setup with IIS virtual directories. Anyone soing this sort of thing in IIS? Am I in for a rude awakening?



-Aaron
@rich, nice to know. I sustpected it would be basically the same process using a gui. I agree that the Apache config process is clearer and easier (once you've worked with it for a while).
Thanx for the post.
How can I define this alias for a directory which is on Server 2 with some IP