[英]Drupal redirect to web folder
I'm trying to configure redirects on a drupal site using apache web server.我正在尝试使用 apache web 服务器在 drupal 站点上配置重定向。 I'm trying to implement this https://www.symphonythemes.com/drupal-blog/remove-web-part-composer-based-drupal-site but I cannot seem to get it working.
我正在尝试实现这个https://www.symphonythemes.com/drupal-blog/remove-web-part-composer-based-drupal-site但我似乎无法让它工作。 I have several drupal sites running in
/var/www/html/drupal
.我有几个 drupal 站点在
/var/www/html/drupal
中运行。 My drupal configuration in my httpd.conf files are我的 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
and和
- 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
I've added我已经添加
if ( isset($GLOBALS['request']) && '/web/index.php' === $GLOBALS['request']->server->get('SCRIPT_NAME') ) {
$GLOBALS['request']->server->set('SCRIPT_NAME', '/index.php');
}
to my settings.php.到我的设置。php。
Now I'm trying to get my .htaccess
files correct for my drupal app which is in /var/www/html/drupal/app
.现在,我正在尝试让我的
.htaccess
文件对/var/www/html/drupal/app
中的 drupal 应用程序正确。 In /var/www/html/drupal/app/.htaccess
I have在
/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>
In var/www/html/drupal/app/web/.htaccess
I have在
var/www/html/drupal/app/web/.htaccess
我有
RewriteBase /web
When I visit https://example.com/app I get redirected to my OIDC provider but the redirect_uri
is missing the /app
.当我访问https://example.com/app时,我被重定向到我的 OIDC 提供商,但
redirect_uri
缺少/app
。 And when I visit https://example.com/app/user/login I get a 404, but prior to adding .htaccess
https://example.com/app/web/user/login was working.当我访问https://example.com/app/user/login时,我得到了 404,但在添加
.htaccess
https: //wasweb.com/ Any help would be much appreciated, thank you.任何帮助将不胜感激,谢谢。
I needed to change var/www/html/drupal/app/web/.htaccess
to我需要将
var/www/html/drupal/app/web/.htaccess
更改为
RewriteBase /app/web
and settings.php to和 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');
}
But I think creating a virtual host for each site would allow the original configuration to work as @2pha suggested但我认为为每个站点创建一个虚拟主机将允许原始配置按照@2pha 的建议工作
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.