• [Drupal] multi site with subdomain running the same code in Drupal


    I have a default site with url www.example.com, and now I want to build another subsite with subdomain mysite.example.com.

    1. Set the folder of the submain.

    Create a folder mysite.example.com under sites, that is sites/mysite.example.com. Be aware of the name of the folder, because I want to create the a subdomain as mysite.example.com, so I have to set the name as "mysite.example.com".

    And the copy the file from sites/default/default.settings.php to sites/mysite.example.com/default.settings.php, and rename it to settings.php.

    2. Set the hosts.

    Modify the hosts file. Add the following code:

    127.0.0.1 www.example.com
    127.0.0.1 mysite.example.com

    3. Set the virtualHost

    Modify the httpd.conf file.

    代码
    NameVirtualHost *:80
    <VirtualHost
    *:80>
    <Directory
    "/media/MyDocuments/xampp/htdocs/drupal">
    <
    /Directory>

    DocumentRoot
    "/media/MyDocuments/xampp/htdocs/drupal"
    ServerName www.example.com
    ServerAlias www.example.com mysite.example.com
    <
    /VirtualHost>

    4. Set the clean urls

    Modify the .htaccess file under the root folder, key codes as :

    代码
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond
    %{REQUEST_FILENAME} !-d
    RewriteCond
    %{REQUEST_URI} ^/~kerunt/site/mysite
    RewriteRule ^(.
    *)$ mysite/index.php?q=$1 [L,QSA]

    RewriteCond
    %{REQUEST_FILENAME} !-f
    RewriteCond
    %{REQUEST_FILENAME} !-d
    RewriteCond
    %{REQUEST_URI} !=/favicon.ico
    RewriteRule ^(.
    *)$ index.php?q=$1 [L,QSA]

    Ok, now you can visit the url mysite.example.com and build a new subsite with the same code!

    Have fun!

  • 相关阅读:
    jsp获取当前目录下的文件和目录,获取windows盘符
    WAS常用配置的文件
    Was提示SOAP链接不上可能停止 但WAS已经启动
    git本地仓库提交到远程
    ubuntu1804时间相差8小时
    docker安装&卸载
    ubuntu 安装离线字典
    写给还没入门的网页设计师们
    简单10步,建立一个完美的商业网站
    不会配色?来看看网页设计中怎样使用柔和色调
  • 原文地址:https://www.cnblogs.com/davidhhuan/p/1782391.html
Copyright © 2020-2023  润新知