zoukankan      html  css  js  c++  java
  • [Drupal] Simple tutorial of setting multi subdomain with Domain Access module and Views module

    1. Set the hosts file.
    Open /etc/hosts file, add the code as below for example:

    # drupal
    127.0.0.1   drupal2.39.lan.gz
    127.0.0.1   *.drupal2.39.lan.gz

    2. Set the Virtual Hosts in Apache
    Open /opt/lampp/etc/httpd.conf, add the code as below for example:

    <VirtualHost *:80>
        <Directory "/media/MyDocuments/xampp/htdocs/drupal-2">
        </Directory>

        DocumentRoot "/media/MyDocuments/xampp/htdocs/drupal-2"
        ServerName drupal2.39.lan.gz
        ServerAlias *.drupal2.39.lan.gz
    </VirtualHost>

    3. Install the views module

    4. Install the Domain Access module.
    here I use the sites/default as a the primary site, so now edit
    the sites/default/settings.php, at the end of this file, add the code as below:

    /**
     * Add the domain module setup routine.
     */
    include './sites/all/modules/domain/settings.inc';

    Please see more details for why to add the code in the INSTALL.txt of Domain Access module.

    5. Set the subdomain in the website.
    Visit the page, http://drupal2.39.lan.gz/admin/build/domain , select the "Create domain
    record" tab to create a subdomain, here I create a subdomain as village-1.drupal2.39.lan.gz
    for example, so in the Domain field, I insert village-1.drupal2.39.lan.gz , and the Site name
    you can insert what you like. And then save it.
    Then as the steps above, I create another subdomain village-2.drupal2.39.lan.gz

    6. In the page http://drupal2.39.lan.gz/admin/build/domain
    "Domain node types" fieldset, uncheck all the checkbox for that I hope that all the content
    the editors created only display in the suddomain he belongs to. "Domain-specific settings"
    fieldset, select the "All domains" radiobox, and then save.

    7. Set the role of the Users.
    Visit the page, http://drupal2.39.lan.gz/admin/user/permissions/2 ,
    in the "domain module", check the checkbox as below:

    access inactive domains (option)
    administer domains
    edit domain nodes
    publish from assigned domain (option)
    publish from default domain (option)

    in the "node module", check the checkbox as below:

    access content
    create TYPE content (TYPE means that any content types in your website)
    edit own TYPE content (TYPE means that any content types in your website)
    revert revisions (option)
    view revisions (option)

    That is the option I suggest to set, of course, if you know what is the difference between them,
    you can set what you wish. :)

    8. Add some users.
    In the page, http://drupal2.39.lan.gz/admin/user/user/create ,
    Add the user, please be aware the "Domain access" fieldset, here you can set the subdomain
    which the user belongs to. Here is the example:
    editor1, village-1.drupal2.39.lan.gz
    editor2, village-2.drupal2.39.lan.gz

    9. Use views module to set the default page to the subdomain.
    In the page, http://drupal2.39.lan.gz/admin/build/views/add , here is an example,
    View name: village_page
    View type: Node
    Then click next
    Add display, in the "page settings" fieldset, set the path to "home", please pay attention to
    "Filters" fieldset, select the "Domains" in the "Groups", and then select checkbox
    the "Domains: Domain ID", in the next step, select the "Current Domain", save.
    About how to set the views parameters, please see the details in drupal.org/project/views.

    10. Set the default page of the subdomain.
    In the page, http://drupal2.39.lan.gz/admin/build/domain , click settings of village-1.drupal2.39.lan.gz ,
    in the "Site frontpage: " fieldset, insert the page path I set in above step -- that is home, save.
    Set that to village-2.drupal2.39.lan.gz in the same way.

    11. Login editor1 in village-1.drupal2.39.lan.gz
    Create some content after login.
    Login editor2 in village-2.drupal2.39.lan.gz
    Create some content after login.

    Then you will find that, that is differece when visiting village-1.drupal2.39.lan.gz and village-2.drupal2.39.lan.gz


    That is all of simple set the Domain Access module.

  • 相关阅读:
    感觉每天打开自己的博客园, 想编程的心情就多了起来~~~
    算法图解相关代码整理
    github cli
    What's WebFlux ? And how to use it ? 一股有咖喱味的WebFlux简介
    style
    gradle 1
    gradle打包可运行jar
    外面下着雨
    天晴朗 看花儿多多开放
    Full Stack Reactive with React and Spring WebFlux
  • 原文地址:https://www.cnblogs.com/davidhhuan/p/1793378.html
Copyright © 2011-2022 走看看