Page 1 of 2

Announcement: New module MultiDomains

Posted: Thu May 20, 2010 6:33 pm
by Andiministrator
Within the last two weeks I developed a new module for CMSms: MultiDomains
Download: http://dev.cmsmadesimple.org/project/files/852

This module provides support for the use of different domains with one installation of CMSms. You can assign each domain to a page (or page-tree). The module will redirect the domain automatically.
Furthermore the module supports 301 redirects of moved pages (or old urls) to new pages (well, that what the module MovedPages) does.
Last but not least it has a small statistic, how many visitors each domain has.
And - it has support for a development server, so you dont need to change your database before you transfer it.

Ok, here are some guidelines, how to use the module:
1. Enable mod_rewrite
- Open the file "config.php" (in the CMSms root directory) and set the parameter "url_rewriting" to "mod_rewrite" (if it is not already done)
- Create a new file named ".htaccess" (if it not already exists) in the CMSms root directory with (at least) the following content:

Code: Select all

# .htaccess for CMS made simple
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !/$
RewriteCond %{REQUEST_URI} !\.
RewriteCond %{REQUEST_METHOD} !POST$
RewriteRule ^(.*) %{REQUEST_URI}/ [NE,R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC]
RewriteRule ^(.+)$ index.php?page=$1 [QSA]
# EOF
2. Insert the module placeholder in your template
Insert the following placeholder at the beginning of each page template:

Code: Select all

{cms_module module='MultiDomains'}
The placeholder MUST BE AT THE BEGINNING of your template (before "{process_pagedata}")!
3. Add your domains in the module backend
Go the the module backend (Extensions/MultiDomains) and add your domains and its associated pages.

If you get problems with using this module, please send me a problem description.

Happy MultiDomaining!

Re: Announcement: New module MultiDomains

Posted: Thu May 20, 2010 8:55 pm
by Aureli
Excellent!
I was just having a look at this post to see how could I use the same content to create a "normal" site and a smaller scale mobile site. (http://forum.cmsmadesimple.org/index.php?topic=25495.0).

So could this module do this: have www.mysite.com and use the same content to create a mobile site in  mobile.mysite.com?

Gotta give it a go!
Thanks.

A.

Re: Announcement: New module MultiDomains

Posted: Thu May 20, 2010 9:01 pm
by jchelpdeskwv
Thank you very much!

Re: Announcement: New module MultiDomains

Posted: Fri May 21, 2010 5:17 am
by Andiministrator
Aureli wrote: So could this module do this: have www.mysite.com and use the same content to create a mobile site in  mobile.mysite.com?
The module needs a different page(-tree) for every domain. E.g.:

Code: Select all

Startpage  --> Standard Domain (e.g. my-website.com)
  |--> Pagetree 1 --> domain-1.com
  |        |--> Page 1
  |        `--> Page 2
  |--> Pagetree 2 --> domain-2.com
  |         |--> Page 4
  |...
So, if you work with a different content tree for your mobile site, try this module.

Best regards
Andi

Re: Announcement: New module MultiDomains

Posted: Fri May 21, 2010 5:18 am
by Andiministrator
Dr.CSS wrote: NOTE: This module will most likely NOT be supported by Devs, so you will have to ask the developer for support...
If you see any conflict with the core modules, please give me a note ...

Re: Announcement: New module MultiDomains

Posted: Thu May 27, 2010 10:07 am
by Andiministrator
I've just released Version 1.3 of MultiDomains.
Download: http://dev.cmsmadesimple.org/project/files/852

There is no smarty placeholder needed anymore in a page template, the module works now using events.

I'm using the event "ContentPostRender" (ContentPreCompile was not working). If you know a better (earlier) event for MultiDomains, please tell me ...

Re: Announcement: New module MultiDomains

Posted: Sat Jun 05, 2010 10:52 pm
by NaN
Andiministrator wrote:
I'm using the event "ContentPostRender" (ContentPreCompile was not working). If you know a better (earlier) event for MultiDomains, please tell me ...
Did you try SmartyPreCompile or TemplatePreCompile?



EDIT:

All the PreCompile stuff seems not to work with cached pages. Because if a page is cached it actually won't be really compiled anymore (since it actually already is). Only the cached php scripts will be processed. And so no PreCompile events are triggered.
So ContentPostRender might be the only event that is always triggered.
Unfortunately there is no "OnPageAccess" event that is triggered before or after the content object has been loaded.

Re: Announcement: New module MultiDomains

Posted: Mon Jun 07, 2010 8:37 am
by Andiministrator
Thanks for your interesting reply.
So for now I'll use the event "ContentPostRender".
An "OnPageAccess" would be cool ...

Re: Announcement: New module MultiDomains

Posted: Sat Jul 31, 2010 7:41 pm
by djkirstyjay
Can you tell me how this module actually works?

It's very interesting.... I have actually been hosting many sites on one CMS installation for a while, but have had to use domain redirects. I'm really interested in this, but cannot find a good explanation of what it does.

Thanks in advance :)

Re: Announcement: New module MultiDomains

Posted: Sun Aug 01, 2010 6:07 pm
by Andiministrator
Did you have a look in the module help?

Re: Announcement: New module MultiDomains

Posted: Mon Aug 02, 2010 10:51 am
by djkirstyjay
Yes I did... it says "This module allows to use multiple domains with CMS made simple. You can assign domain names to existing pages."... but what I would like is an explanation of how.

Do I assign a domain to the same nameservers as my CMS installation and it will detect the domain name and open a specific part of the CMS...? If not, how does it work?

:)

Re: Announcement: New module MultiDomains

Posted: Mon Aug 02, 2010 10:56 am
by Andiministrator
djkirstyjay wrote:Do I assign a domain to the same nameservers as my CMS installation and it will detect the domain name and open a specific part of the CMS...?
Yes, exactly.
Here the way how to implement the module:

1. Enable mod_rewrite
- Open the file "config.php" (in the CMSms root directory) and set the parameter "url_rewriting" to "mod_rewrite" (if it is not already done)
- Create a new file named ".htaccess" (if it not already exists) in the CMSms root directory with (at least) the following content:

Code: Select all

# .htaccess for CMS made simple
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !/$
RewriteCond %{REQUEST_URI} !\.
RewriteCond %{REQUEST_METHOD} !POST$
RewriteRule ^(.*) %{REQUEST_URI}/ [NE,R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC]
RewriteRule ^(.+)$ index.php?page=$1 [QSA]
# EOF
2. Add your domains in the module backend
Go the the module backend (Extensions/MultiDomains) and add your domains and its associated pages.

Re: Announcement: New module MultiDomains

Posted: Mon Aug 02, 2010 11:28 am
by djkirstyjay
Andiministrator wrote:
djkirstyjay wrote:Do I assign a domain to the same nameservers as my CMS installation and it will detect the domain name and open a specific part of the CMS...?
Yes, exactly.
Fantastic mod. :)

I have actually been doing this for about two years using the masked redirects from my server, however this actually makes it soooo much better.

Now the only thing that remains to be done in order to make the CMS truly multi-user/domain, is to have it so that you can assign individual users permissions to access module admin for only their site... for example, if you have the guestbook installed, then a user would see all the comments for their guestbook and not all guestbooks, or just manage their own forms in formbuilder, or galleries in album.

I'm not asking you to do it, just thinking out loud :D I have tried to find a way myself for this... maybe with multiple installations of the same module... one for each domain...

Re: Announcement: New module MultiDomains

Posted: Wed Sep 01, 2010 1:00 pm
by djkirstyjay
Right... I have installed your mod (latest version - 1.3.1) on CMSMS 1.8.1.

I have followed the instructions above.

My site tree is as follows :

1 - clubactivo.com (page seperator)
1.1 - contact
1.2 - home (default page)
1.3 - etc....

2. - gol-mundial.com
2.1 - home (default page)
2.2 - etc...

I have edited my .htaccess file as you said. I just copied and pasted your code into it.

I have edited my config.php as you said, and changed it to mod_rewrite.

When I try to access the site, clubactivo.com, I get the following error :
The page isn't redirecting properly          

Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

   *   This problem can sometimes be caused by disabling or refusing to accept
         cookies.
The site only works when I make the site inactive in the MultiDomains control panel

Update* : It's now working when I remove the www prefix option in the domain options. Why is this a problem, and what is the option there for?

Although I have solved the issue, I'm still posting this post in case anyone else has a problem getting it working and it can help them solve it too :)

Re: Announcement: New module MultiDomains

Posted: Sat Sep 04, 2010 10:53 am
by djkirstyjay
I have set up gol-mundial.co.uk and added it to multidomains, as in my previous post. The domain has propagated, but it's still only going to clubactivo.com. It's quite urgent that I get this sorted, as people need to start booking courses today.

I thought I had it sorted, so any help is greatly appreciated!!!

All my server, CMS and module info is on my previous post. I can't retype at present, as I'm on my mobile.

Thanks in advance!