J$ thinks I should Only Use mod_rewrite When You Have To, and I argue that in my case, Alias would not accomplish what I wanted to do. He claims that Alias is the directive I'm looking for, but I disagree. The Apache docs describe the Alias directive in the following:
The Alias directive allows documents to be stored in the local filesystem other than under the DocumentRoot. URLs with a (%-decoded) path beginning with url-path will be mapped to local files beginning with directory-filename.Example:
Alias /image /ftp/pub/imageA request for http://myserver/image/foo.gif would cause the server to return the file /ftp/pub/image/foo.gif.
This is not the behavior I wanted. In order for me to modify the filesystem layout but not the docroot, change the URL of my blog, allow existing bookmarks to work, and most importantly, return a 301 (Moved Permanently) response to all agents requesting the page, the power of mod_rewrite seemed appropriate. With a 301, google and bloglines have already updated themselves to the change, which would not have happened had I simply used the Alias directive. I don't even think the Alias directive would have accomplished this at all. That seems to be solely for mucking with files beyond the scope of the DocumentRoot, which was not a part of this transition.
All that said, it would appear that the Redirect directive is what I was really looking for all along. It only took me 18 months to make that change, it'll hopefully take less than that to change it again.
mod_rewrite is my hammer. This looked like a nice nail.
Post a comment