great, i still have one issue though making sub.domain.com an alias of domain.com
i don’t want to use redirect 301 because that would tell the search engine that it permanently has been moved, so far my hosting CP does not have anything that can help me to make it an alias
they have 3 options domain alias, server alias and add cname, i think because in the dns it shows * domain.com i can add a word by typing it in the URL not sure if that makes it an alias
Would be cool to have one engine, domains, subs that had their own content so xxx.yyy.com wouldn’t be able to change the template aaa.bbb.com or www.yyy.com.
That might be a big core code change to support that.
But of course if it supported that out of the box - that would be kick ass.
The hack works nicely, but sure gets messy when adding more subs
i.e.,
$domain1 domain.com
$domain2 www.domain.com
for every domain you need to add one more for www.
is there a way to rewrite code for easier management of multiple subs and repeating items ?
Well, this code is more for subdomains (sub1.whatever.com, sub2.whatever.com, etc.) than for multiple full domain names (something.com, something-else.com, etc.). But that wouldn’t be tough to fix if you want to. You could just remove the subdomain part of the host string with something like:
...
$s = $_SERVER['HTTP_HOST'];
$chunks = explode(".", $s);
$s = $chunks[1].'.'.$chunks[2];
...
Although I think that I would either strip the www (or always add it) in .htaccess rather than deal with that in PHP personally.
Well why not do it in MySQL - Setup a table for a domains, subs for that, Alias cross linking and such. Then just give each domain / sub their own db for their content.
Future versions of MODx will be more multi-site (and multi-language) friendly right out of the box; the code here is for making this work easily using the current version of MODx.
"Just a quick FYI on the subject, the next release following 0.9.5 will most-likely contain a solution to this in the form of what I like to call Contexts."
Am wondering if this is available as yet? Having one install for multiple separate domains per server would be awesome without having to make all these file modifications.
-
MODX Staff
- 10,725 Posts
This will be part of the 0.9.7 release and using contexts as subdomains within a single MODx database is in final stages of development and moving into testing.