Recent Topics

2 Collection into a second domain

started by on Jul 12, 2017 – Last touched: Jul 14, 2017

Jul 12, 2017 13:59    

Hi, on my private server I've setup 2 domain, to make it easier we can call it main.com and other.com
at the moment I have made 3 collection the first collection are the main collection and are opened from main.com, the second collection are other collection and are opended from other.com, for now all right.
So all work well, but I have a problem, I need to open the third collection from other.com and not from main.com, In the sense that when I open the third collection I do not have to appear main.com/thirdcollection on url but must look like other.com/thirdcollection to the user, since the third collection is an integral part of the second one, it would be strange a change of domain

From settings I've tried to change the url of third collection into other.com/thidcollection but when I open the collection from the link b2e return this:

404 Not Found
b2evolution cannot resolve the requested URL.

how I can solve that issue?

Jul 13, 2017 12:40

Ok, I know that a double post isn't good, but I've solved the "issue" (into "" because for me are an issue, for you I don't know) mentioned in this thread and at the same time partially solved the issue mentioned into the thread http://forums.b2evolution.net/link-to-main-collection-and-about-page-related

now i can see the secondary domain in every collection and at the same time i can see the main domain in every collection witouth make strange redirection or modification at server level, the collection saved with the secondary domain are opened when i put into the browser the secondary domain and at the same time is visible with the correct url into main site, when I log-in like administator no strange redirection or issue with back-office (yes I can edit everithing into back-office from secondary domain).
All of this on my local wamp server, i don't have a real runnable server for test it, cam be usefull if someone can test it on various server type (like shared host with cPanel for example or similar)

How I made it possible, I searched a lot into configuration file for handle the best and easy practice to apply and I found it!!
I have simply added this line of code $baseurl = 'http://'.$_SERVER['HTTP_HOST'].'/'; after the original that have static link at the main domain (I mantained the original for precaution but probably is unnecessary)

Unique aspect that at the moment i can't change is the about page, because if "contact" and "login" from option can be changed to "current collection" the about page don't have that option so, is a little frustrating but respect to the above hack add a new option to the about configuration is out of my capacity because I don't know where is located the code for it, how is loaded the about page and how replicate and make it unique for every alternative domain.

Just a note for the "contacts" and "login" pages is required the version 6.8.9 of b2e otherwise they will retun an error.

Jul 14, 2017 01:17

@jinkazama82it I think that your new $baseurl value doesn't solve the 404 error when visiting http://other.com/thirdcollection. Am I right?

In order to make it work, you may do the following:

(I haven't seen this technique used in a b2evolution site before, but it may do the trick since it's a common solution recommended and applied by other platforms on production sites)

  1. Create a folder thirdcollection at the root of your site.
  2. Create a stub file index.php pointing to the collection inside the new folder (more info here: http://b2evolution.net/man/stub-file).
  3. (this is the tricky part) Create symbolic links inside the new folder to the following root folders: htsrv, media, plugins, rsc and skins. The most common way to do this in *nix systems is through the following command: ln -s ../htsrv htsrv. If you have no chance to create the links by your own in your online server, you should ask customer support to do it for you.
  4. Copy the default .htaccess file into the new folder.
  5. Configure the URL section of the new collection as displayed in the screenshot below.

I would like to stress this out: such a technique like this is perfectly valid, and in a quick few tests I did it seems to work, but you should make many more test before to use it on a production site. Please let us know how it goes.

Regards!

Jul 14, 2017 07:28

At the moment I haven't problem, I have into my local sever main.com and other.com and all work well for the second or other collection in other.com some shrewdness need to applied for other.com is to change the cookie value from .other.com to other.com and any new collection that need to be opened under other.com need to set the Collection url like extra path on baseurl.

only one thing I need to hack at the moment and is the short name for the link that return at the current domain, with my hack now it return at the correct domain main.com or other.com) but have the same short name of main.com (it is a parameter put in during installation) but probably I need more time for that (I need to investigate more into the code for find a clean and easy solution)


Form is loading...

powered by b2evolution free blog software – This forum is powered by b2evolution CMS, a complete engine for your website.