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.

  • 相关阅读:
    angular 封装http请求、解决跨域问题
    TCP协议数据读取
    Dart里继承extends和实现implements的区别
    MySQL通过frm和ibd恢复表结构和数据的办法【基于Linux和MySQL5.6.23测试】
    Dart里实现可增长List和定长List的runtimeType的toString()的值是一样的功能
    MySQL位判断
    SpringBoot URL参数解析坑
    android 实用抓取手机log方法(均为转载)
    python 创建动态类
    Mac技巧之苹果电脑上将一个软件进程的 CPU 占用率限制在指定范围内:cputhrottle
  • 原文地址:https://www.cnblogs.com/davidhhuan/p/1793378.html
Copyright © 2011-2022 走看看