Forum Moderators: phranque
I'm new to the site and have a tough little task at hand. I have a server running apache 1.3. This is a shared server which hosts multiple vhosts. One of our clients has a vhost configured that configures multiple sites beneath the vhosts document root. This is all fine as normally we could just adjust the DNS and have the site redirect to domainName.com/exdirectory/exdirectory1/exdirectory2. The tough part is that the client has requested that the URL read only domainName.com excluding the path to the directories in the URL. Is this possible? What are some of the advantages of this configuration, SEO wise. There will certainly be more sites to have to implement this on. Any help would be greatly appreciated.
Do not do an external redirect, as that will cause your clients untold trouble getting their sites properly indexed by search engines, and if the word gets out, could cost you your business. Your customer is right -- a virtual host should be directly-accessible using its own domain name.
Instead, if you must use a rewrite/redirect approach instead of a proper vHosting configuration, use an internal rewrite. The "Mass virtual hosting" section of the ApacheURL Rewriting Guide [httpd.apache.org] contains some pointers for using mod_rewrite to do this.
The downside of this approach --in contrast to proper vHosting-- is that you will introduce dependencies based on the order that the Apache modules run, as defined by the reverse LoadModule order on Apache 1.x and by the internal Apache 2.x module execution priority scheme; You will have to make sure that mod_rewrite runs before any other modules if you want the requests to be mod_rewritten to the proper domain/subdirectories and the for "users" to be able to use those other modules properly.
Just as one example, if mod_auth runs first before the request are delivereed to the proper domain/subdirectory by mod_rewrite, then customers of that domain/subdirectory won't be able to use mod_auth properly.
All-in-all, doing it this way is a kludge and has serious security implications. As much as I like to use mod_rewrite, I cannot recommend anything other than proper VirtualHost configurations for a commercial shared virtual server hosting account.
Jim