Saturday 25 October 2008 11:54:38 pm
Absolute urls will include the domain name in the href tag, which would introduce complexity as it would likely point to mydomain.com rather than username.mydomain.com, which pushes you back to the wrong style of URL. I haven't had chance to sit down and try it out, but I imagine you could: Catch incoming request for "username.mydomain.com", rewrite it is mydomain.com/Blogs/username, without a redirect. This should preserve the original requested URL "username.mydomain.com" in the browser address bar. The issue you run into now is that you have to catch the links to blog posts, and ensure they are properly handled. If they are in the format "mydomain.com/Blogs/username/my-post" then you need to rewrite your templates. You have two options. 1. You could try and use the template language to evaluate the HTTP_HOST and provide the appropriate domain in an absolute URL, OR 2. You could use relative urls, ie "/Blogs/username/my-post" (preferred I think) At that point when you click on a link it should request "username.mydomain.com/Blogs/username/my-post" which you can catch with your rewrite rule. One thing you likely cannot do with the above system, is force a redirect on an incoming request for "mydomain.com/Blogs/username" and redirect it to "username.mydomain.com" or you will end up in an endless loop of redirects with a nice 500 error from Apache. You will have to live with the fact that mydomain.com/Blogs/username/my-post is accessible, it has to be to handle requests for your rewrite rule anyway, but your subdomains should work for the blog and deeper links.
Andrew Duck, Executive Director, Quiqcorp Limited
eZ Certified Developer and Trainer.
Member of the Community Project Board
http://quiqcorp.com | http://twitter.com/andrewduck
|