How can i setup database and source code of single domain to be used by multiple domain in drupal? - drupal

I have a used domain access module (Drupal 7) for creating a website. My requirement is, there will be one main site and many sub websites in the same domain. all the sub websites will access the same database and the source code of main website. All this websites will be in a VPS hosting. One Main website and all other sub websites are sub-domains, created. For Example:
enter code here example.com -- Main website.
one.example.com -- sub website.
two.example.com -- sub website.
three.example.com -- sub website.
Now, the scenario is, the database and the source are in example.com. Can I have a sub-website as another domain like apple.com, orange.com -- sub-websites
Is this possible? and in which server I have to place my database and code.

Do you need to share content between the various sites? If so, you'll probably want to use Drupal's Domain Access module (as you've tagged this question). However, if these are all going to be distinct sites that do not have to share content (except maybe through Aggregation or Feeds) - you can avoid that module.
I'm pretty sure the approach you want to take is documented here: https://drupal.org/node/2622 - basically, you use one database, but each site uses its own table prefix to distinguish it from the other sites.
As far as running multiple sites from one Drupal root, you can use the built-in multisite support: https://drupal.org/documentation/install/multi-site . I don't think you will need drupal domain access at all in this case.

Related

Installing multiple different instances of wordpress on the same website

I currently have a website up and running that is my freelancing website. What I wanted to do was create a testing subdirectory on the website.
So for example my site would be:
website.com
I want the testing site to be: website.com/test
I need this test to be private and require a password to view, as well as be a different installation of wordpress so I can manipulate it without editing my main website. Is this possible? Currently I have created a test directory from the cPanel that requires a password but it just brings me to a 404 not found page.
I would also like to create more, public, instances that I can use as a portfolio until I get more real clients. So for example I would like to have my site be: website.com/themeOne
Is any of this possible, or am I out of luck? Please let me know I would greatly appreciate any help. Anything I found found online thus far has either not been relevant or has not worked.
You can achieve this by setting up a wordpress multisite installation. I currently use this to host all my clients.
Will work like this.. Main site is website.com
Depending on how long you have had that site set up will determine whether your multisite install will be a subdirectory or a subdomain. If you have had your main site for a while it will be subdomains. ie. xyz.website.com
You will have to set up a wild card subdomain on your server though...so keep that in mind.
Here is the documentation on setting up a wordpress multisite
https://premium.wpmudev.org/blog/ultimate-guide-multisite/
You can install as many WordPress instances as you like in subfolders example.com/test/ or subdomains test.example.com in one hosting account; see http://codex.wordpress.org/Installing_Multiple_Blogs. (You are, of course, limited if your host does not support subdomains. And you may find lots of sites with lots of traffic will slow your whole hosting account.)
For these separate WordPress installs, you can use the same database; simply give each WordPress install a different database table prefix in wp-config.php. https://codex.wordpress.org/Editing_wp-config.php Or, give them all the installs a totally different databases, only limited by your hosting account.
To control access to a WordPress site, there is no need for access control in .htaccess or via Cpanel; use any one of a number of plugins that allow you to restrict access to anyone not logged into WordPress. See https://wordpress.org/plugins/search.php?type=term&q=password
And you can still control the user's role when they are logged into the site with one of those plugins, i.e. editor, administrator, etc., from within WordPress. That's because you want to give a client a Subscriber user level so they can simply login and view the site, rather than Administrator, who can see posts, plugins, etc. See https://codex.wordpress.org/Roles_and_Capabilities
There is no need for WordPress Multisite, unless you want to go that way: see https://codex.wordpress.org/Create_A_Network But be aware that MS requires more server and DNS configurations if you want to use Domain Mapping: https://wordpress.org/plugins/wordpress-mu-domain-mapping/

Is it possible to setup wordpress separately in main domain and sub domain?

At the moment, I have a wordpress-based site at http://sub.mydomain.com, running for 2 years already.
Now I decided to setup another wordpress site, to be used separately from http://sub.mydomain.com, at http://www.mydomain.com.
My question is would the new setup causes any damage to the site in sub domain? If yes, Could you guide me how to avoid it?
No, they should exist in seperate space on the server's file system so it should be fine. Seperate databases, seperate urls, etc.
edit:
our dev server has dev1.oursite.com, dev2.oursite.com etc on it. Multiple subdomains running wordpress, magento, and drupal with no problems.
markratledge is correct you can install it to the same database with a different prefix, but there is no real benefit to doing so unless your host has limited the number of databases you can have, or you only want one DB to backup. But either method is fine, no conflicts.
You can use the same database, but use a different database table prefix to not overwrite the subdomain's tables. I.e., wpsub_options, etc.
See http://codex.wordpress.org/Installing_Multiple_Blogs

Drupal installation and domain naming strategy?

I have a my main site, called "mysite.com" (for arguments sake). On this site, you will find my blog and everything I do. But I am starting another site that I want to run on my domain. However:
The other site must have it's down domain name: newsite.com
If people go to mysite.com/newsite it must redirec to newsite.com
If people go to newsite.com, it must show the content of what they would see if they had gone to mysite.com/newsite in the past
So basically, I want a "page" or actually a whole section ( mysite.com/newsite/* ) to appear as newsite.com in the browser.
Why?
I want both sites to run off one drupal installation
I want both sites to look basically the same
However, keep in mind that I don't want to use a multi-drupal solution. i.e. a module that allows for more than one copy of drupal to run off 1 installation.
http://drupal.org/project/domain allows you to configure various things based on the domain, for example accessible nodes.
You can probably do the redirect with a Rewrite Rule, outside of Drupal or write a simple module that does that.
Sounds simple to do. Just install the second site using a regular multi-site installation. (Google "drupal multi-site instructions"). Then install the Path redirect module and create the external redirect to the new domain. http://drupal.org/project/path_redirect

Changing base domain / allowing multi base domains

I have a new client that I am converting over to Drupal from Wordpress. We have two domains with the same name but different TLDs i.e. .com & .org. We have decided to start by setting up the site first under the .com so we have a live site to play with during the development.
So we currently have a wordpress site running on the .org and drupal (on a new host) running on the .com domain.
So two questions:
Can and How do you configure Drupal to work for both the .com and the .org ?
Can and How do you change the base domain drupal is configured with after the site is live ?
If you aren't using Drupal's multisite system (that is, the site information is being put into sites/default instead of sites/example.org or sites/example.com), this is really easy: do nothing. There is no step 2. Drupal will handle any domain thrown at it: just use your web server's name-based handling to determine which domains to accept.
If you are using Drupal's multisite system, it's a little harder:
Rename the sites folder (so from sites/example.com to sites/example.org).
Drupal's files table hardcodes the files directory it uses, so you're going to need to change all the paths in it. Run UPDATE files SET filepath = REPLACE(filepath,'example.org','example.com') on the database.
The other place to change the path is under Site Configuration -> File system.
The final place you're going to need to change paths is going to be on the settings page for your theme if you decided to use a custom logo or favicon.
Once you've changed all the paths, rebuild the cache under Site Configuration -> Performance.
This should cover most cases. Check with the third-party modules you're using to see if they also hardcode filepaths. If the modules are using the API correctly, they should've been handled in steps 2 and 3.
Because of all the hardcoded file paths, I highly recommend not using multisite unless you really need to. If you are only running one site in a Drupal install, just stick the site in sites/default.

View a site without a domain WITHOUT updating hosts file?

I have a few sites I developed that I need to show my client for review. These are all redesigns of live sites, so they've had me upload them to their new hosting server, which is currently accessible via IP address because the domains are currently in use by the live sites.
I've set each site up as add-on domains in cpanel, and they all live in directories off the root, like 192.0.2.3/site1.example (for example).
However, these are Wordpress sites, and the database references the actual domain name (site1.example), so that it will be all set for launch when we update the DNS to point to this server. That means you can't actually see the site at that domain unless you update your hosts file. But there are lots of non-technical people that need to review the site, and updating their hosts file just isn't an option.
I'd rather not have to do a search and replace on the database to change the domain to 192.0.2.3/site1.example temporarily, just so they can view it. Because when we're ready for launch, I'll just have to do another search and replace to switch it back to the real URL. But it seems like that's my only option.
Is that correct, or is there another way they can view the site without me having to update all the URLs in the database?
The best solution here is to search and replace the URL just as you said

Resources