簡體   English   中英

Drupal 重定向到 web 文件夾

[英]Drupal redirect to web folder

我正在嘗試使用 apache web 服務器在 drupal 站點上配置重定向。 我正在嘗試實現這個https://www.symphonythemes.com/drupal-blog/remove-web-part-composer-based-drupal-site但我似乎無法讓它工作。 我有幾個 drupal 站點在/var/www/html/drupal中運行。 我的 httpd.conf 文件中的 drupal 配置是

- name: create drupal httpd conf
    copy:
      content: |
               <VirtualHost *:80>
                 ServerName qsd
                 DocumentRoot /var/www/html/drupal
                 <Directory />
                    Options FollowSymlinks
                    AllowOverride All
                 </Directory>
               </VirtualHost>
      dest: /etc/httpd/conf.d/drupal.conf

- name: allow override /var/www/html
    copy:
      content: |
                <Directory "/var/www/html">
                  Options Indexes FollowSymLinks
                  AllowOverride All
                  Require all granted
                </Directory>
      dest: /etc/httpd/conf.d/app.conf

我已經添加

if ( isset($GLOBALS['request']) && '/web/index.php' === $GLOBALS['request']->server->get('SCRIPT_NAME') ) {
    $GLOBALS['request']->server->set('SCRIPT_NAME', '/index.php');
}

到我的設置。php。

現在,我正在嘗試讓我的.htaccess文件對/var/www/html/drupal/app中的 drupal 應用程序正確。 /var/www/html/drupal/app/.htaccess我有

<IfModule mod_rewrite.c>
RewriteEngine on
# Redirect to the subdirectory because that's where Drupal is installed
RewriteBase /app
RewriteRule (.*) web/$1 [L]
</IfModule>

var/www/html/drupal/app/web/.htaccess我有

RewriteBase /web

當我訪問https://example.com/app時,我被重定向到我的 OIDC 提供商,但redirect_uri缺少/app 當我訪問https://example.com/app/user/login時,我得到了 404,但在添加.htaccess https: //wasweb.com/ 任何幫助將不勝感激,謝謝。

我需要將var/www/html/drupal/app/web/.htaccess更改為

RewriteBase /app/web

和 settings.php 到

if ( isset($GLOBALS['request']) && '/app/web/index.php' === $GLOBALS['request']->server->get('SCRIPT_NAME') ) {
    $GLOBALS['request']->server->set('SCRIPT_NAME', '/app/index.php');
}

但我認為為每個站點創建一個虛擬主機將允許原始配置按照@2pha 的建議工作

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM