How to link 1000 parked domains to nodes, each with node title corresponding to the domain name I want to build a drupal site in D7 that can host thousands of parked domains as landing home pages. The purpose is to create a system for a domain broker to host many parked domains, each with its own sales page on its parked domain root.

The domain access module serves similar purpose but my experience is that it works for up to 10 domains, after that there are serious usability and performance issues arising.

So I'm looking for a simple alternative. What I need is only one page per domain, with the domain as title (example.com) and a contact form that potential buyers of the domain can use.

Assumption: the 1000 domains have been parked on the drupal installation domain.

If I create 1000 nodes hwith corresponding titles (example.com) how do I make each node the homepage of each parked domain? Maybe using .htaccess rewrites, but Im not good at that. The parked domain must stay as browser address when redirected.

Alternative might be to create one custom panel page and use tokens to use the domain URL in the title and the sales text and contact form. The contact form is just a standard contact form that sends an email to the site administrator.
I'm assuming you have a field on your nodes with the name field_domain.

On your website:


Create a new node. This will be a place holder.
Get the NID.
a) Go go /admin/content/
b) Click edit on this placeholder node
c) Check the url. It will be in the form:
  &nbsp;&nbsp;&nbsp;&nbsp; /node/&lt;NID&gt;/edit
  &nbsp;&nbsp;&nbsp;&nbsp;Get that NID.
Go to your theme. 
On the templates folder, create a file with the name:
node--NID.tpl.php so something like: node--78.tpl.php
On this file, put the following content:  



  &lt?php
    $query = new EntityFieldQuery();

    $query->entityCondition('entity_type', 'node')
      ->entityCondition('bundle', 'article')
      ->propertyCondition('status', 1) // published
      ->fieldCondition('field_domain', 'value',  $_SERVER['SERVER_NAME'], '=');
    $result = $query->execute();

    $nid = array_keys($result['node'])[0];
    if($nid) {
      $nodeObj = node_load($nid);
      $nodeRndr = node_view($nodeObj);
      print(drupal_render($nodeRndr));
    }
  

&nbsp;&nbsp;&nbsp;&nbsp;You need to update 2 things:  

&nbsp;&nbsp;&nbsp;&nbsp;   article to the machine name of the content type you're using.
&nbsp;&nbsp;&nbsp;&nbsp;   field_domain to the machine name of the field you're using.


Now, go to admin/config/system/site-information
Change the front page to node/NID where NID is the value from #4.


Explanation:

What that code does is checks $_SERVER['SERVER_NAME']. This should be the domain that's being used. Using that, it looks to see if there's a node with the field field_domain that has a value that matches $_SERVER['SERVER_NAME'].

If there's a match, it will load the node and render it. 

If not, it should still load the placeholder node you created. This could be your default home page.

Hope this helps.



Original comment:

Have you considered writing some custom code?

If the only thing different is the title. I would create a small module that:


On installation creates a table with a domain and a title column.
When a page loads, reads the table and matches the domain and selects the title.
With the title, on... hook_preprocess_page (probably) you can set the title




I think there's a bit more functionality you want. If you're acting like a broker or if it's only a single owner, you probably are sending an email. So you would need the domain that was visited in the form as a minimum.

You can do this by having a hidden field and setting the value on load as well.

Or when submitting the form, reading it and processing it.



If it's more like a marketplace and you're sending an email to the owner which would vary per domain.

I think that processing that after the fact and only having one form would probably be more efficient than having a form per domain.



It depends on the use case. Just offering another option.