我試圖在drupal中使用子目錄設置多站點環境。這裏有一組非常好的說明:http://www.drupalcoder.com/blog/drupal-multisite-in-subfolders,但它是特定於apache,我正在與Nginx合作。Drupal中的多站點環境使用nginx上的子目錄
我怎麼在Nginx的做這些兩兩件事:
從鏈接引用上面:
添加別名Apache配置文件
我們要爲3個子目錄請求去到相同的Drupal 實例。我們可以使用Apache的別名功能來做到這一點。
Alias /subdir1 /var/www Alias /subdir2 /var/www Alias /subdir3 /var/www
我假設這裏Drupal的代碼庫託管在/ var/WWW的 機器上。
重定向所有請求到index.php
現在,我們的服務從一個代碼庫中的所有要求,我們必須 重定向所有請求到index.php。這需要完成,因爲所有的 Drupal請求都來自一個叫做index.php的端點。
RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} ^/subdir1/(.*)$ RewriteRule ^(.*)$ /subdir1/index.php?q=$1 [L,QSA] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} ^/subdir2/(.*)$ RewriteRule ^(.*)$ /subdir2/index.php?q=$1 [L,QSA] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} ^/subdir3/(.*)$ RewriteRule ^(.*)$ /subdir3/index.php?q=$1 [L,QSA]
我已經嘗試了下面提到的解決方案,但都沒有爲我工作。我正在努力解決同一問題! –