zoukankan      html  css  js  c++  java
  • Solution multisite htaccess cleanURL

    My solution to getting Clean URL working with my multisite setup drupal 4.7

    I added Alias to my httpd.conf apache file:

    <VirtualHost *:80>
        # Alias for all php drupal sites
        Alias /abc /var/www/html/drupal
        Alias /def /var/www/html/drupal
        Alias /xyz /var/www/html/drupal
    </VirtualHost>

    My setup has 4 sites /drupal, /abc, /def, /xyz all files are in the /drupal directory

    • url=/drupal (sites/default/)
    • url=/abc (sites/localhost.abc/)
    • url=/def (sites/localhost.def/)
    • url=/xyz (sites/localhost.xyz/)

    In the /drupal/.htacess file. I added a RewriteCond %{REQUEST_URI} condition for
    each site, and so have separate RewriteRule for each site.
    No need for the RewriteBase directive, leave it commented out:

    #RewriteBase /drupal  DO NOT NEED THIS, COMMENT OUT
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} ^/drupal/(.*)$
    RewriteRule ^(.*)$ /drupal/index.php?q=$1 [L,QSA]
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} ^/abc/(.*)$
    RewriteRule ^(.*)$ /abc/index.php?q=$1 [L,QSA]
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} ^/def/(.*)$
    RewriteRule ^(.*)$ /def/index.php?q=$1 [L,QSA]
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} ^/xyz/(.*)$
    RewriteRule ^(.*)$ /xyz/index.php?q=$1 [L,QSA]

    Note: each site has its own database aswell as files, modules and themes directories in the corresponding sites/localhost.site/ directory.

  • 相关阅读:
    1041. 困于环中的机器人
    95. 不同的二叉搜索树 II
    LeetCode945:使数组唯一的最小增量
    LeetCode:925.长按键入
    LeetCode:926. 将字符串翻转到单调递增
    InteliJ 安装PlantUML插件
    CodeBlock换肤
    正则表达式验证手机号和座机号
    C#中使用反射遍历一个对象属性和值以及百分数
    c#中@的用法
  • 原文地址:https://www.cnblogs.com/eastson/p/3352572.html
Copyright © 2011-2022 走看看