Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Alias vs. file system

Status
Not open for further replies.

smah

MIS
Sep 4, 2002
9,396
US
In the course of a task that I'm working on, I came across some cimcumstances that got me thinking and I'm curious about what everyone thinks about this. When using a folder or directory outside the server document root, what are the differences between using Apache's Alias directive vs. a filesystem symbolic link (or shortcut for Windows)? The first thing that comes to mind is that Apache needs to be restarted after changing/adding an Alias directive; a symbolic link does not have this requirement.

The next progression of this idea is: What if both (alias & symbolic link) exist using the same name? Which takes precedence when some contained page is requested from Apache? If the link & the alias point to the same physical location, it doesn't really matter, but what if they point to different physical locations?
 
What twisted mind thought this up? ;-) My guess is that since the alias is already in apache's mind, it would use that first because it would have to wait until it went to the requested dir to see the symlink.
 
Now that we're in agreement (about the twisted mind), this came up when testing a new CMS. Like most CMS's, this particular system uses a folder under the DocumentRoot for storing static images & such. I wanted to move this folder outside the DocumentRoot, so that it could be used by multiple VirtualHosts. I created the appropriate Alias in apache, reconfigured the file system path within the CMS (the url path shouldn't need to change because of the apache Alias, right?), restarted apache & found that it didn't work.

To make a long story short, something is hard-coded into this particular CMS that will cause this scenario not to work unless I use a file system symbolic link where the store folder is expected. In this cace, the apache Alias actually has no effect wether it exists or not, even if I point it to an invalid filesystem path. I [obviously] would have expected the Alias directive to be sufficient.

So, that's how I ended up with this line of thinking and started to wonder if there might be advantages/disadvantages one way or the other. [thumbsup2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top