繁体   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