Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Manage multiple websites from one domain

Tags:

php

.htaccess

I have been looking for a while now to find a solution to accomplish the following system.

I would like to build a PHP system on, let's say, domainA. On this domainA I will allow an administrator to 'create' a new website. This website contains only of pieces of text, which are all stored in a database. This, I know how to do.

However, now I would like to make it possible that visitors that surf to domainB will be invisibly redirected to for example domainA.com/gateway.php?refdomain=domainB&page=xxx or something similar. I have a vague idea this should be done by .htaccess, but I don't really know how I can do this in the most easy way. If for example there are some POST or GET requests on domainB, this should keep working. Also images linked to http://www.domainB.com/test.gif should be invisibly loaded form www.domainA.com.

I also know there are some CMS systems (eg drupal) which allow this feature, so it is possible, I just don't know how.

Thank you for any advice that might point me in the right direction, kind regards, Digits

like image 392
Digits Avatar asked Nov 15 '22 16:11

Digits


1 Answers

Are you hosting both of these on the same machine? If so, something like VirtualHosts in Apache could solve this for you.

mod_alias and mod_rewrite might also be of some use to you.

like image 104
Ben S Avatar answered Dec 18 '22 09:12

Ben S