How can I setup dynamic sub domains?
August 7, 2006 12:09 AM
Subscribe
Sub-sub domains with mod_rewrite - can it be done?
I'm setting up a bunch of domains that follow a consistent naming structure (category/subcategory/file.html). I've setup dynamic wildcards on these domains, and I know how to handle pathing dynamically via PHP, but I'm really interested in setting up a solution like this:
user enters http://subcategory.category.domain.com/index.html, which rewrites to domain.com/category/sucategory/index.html, without changing the browser path.
As an added level of complexity, i'd like to be able to use drupal on some of the subpaths, so I need to be able to honor their htaccess to rewrite their query string.
Any help would be much appreciated, oh tech gods of Mefi!
posted by Vantech to technology (4 comments total)
2 users marked this as a favorite
RewriteCond %{HTTP_HOST} . RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteCond %{HTTP_HOST}<>%{REQUEST_URI} ^([^.]+)\.vantech\.com(:80)?<>/([^/]*) [NC] RewriteCond %1<>%3 !^(.*)<>\1$ [NC] RewriteRule ^(.*) /%1/$1 [L] >>>>That ought to work, but replace vantech.com with your site as required.posted by PuGZ at 1:05 AM on August 7, 2006