简体   繁体   English

如何在drupal8上修复RewriteBase

[英]How to fix RewriteBase on drupal8

problem: I have drupal (8.6) installed on my server and I want it to be accessible by "/drupal" (mysite.com/drupal) , I've used either htaccess and apache2 conf's RewriteBase /drupal , but when I click on connect or anylink in my drupal website it gets me redirected without /drupal , ex: mysite.com/user/login . 问题:我的服务器上安装了drupal(8.6),我想通过"/drupal" (mysite.com/drupal)访问它,我使用了htaccessapache2 conf's RewriteBase /drupal ,但是当我点击时连接或我的drupal网站中的任何链接,它让我重定向没有/drupal ,例如: mysite.com/user/login

apache2 conf: apache2 conf:

<VirtualHost *:81>
ServerName mysite.com
DocumentRoot /var/www/sitesweb/drupal

<Directory /var/www/sitesweb/drupal>
    Options Indexes FollowSymLinks
    AllowOverride none
    Require all granted
    RewriteEngine On
    RewriteBase /drupal
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !=/favicon.ico
    RewriteRule ^ index.php [L]
    php_value memory_limit 512M
</Directory>
LogLevel debug
ErrorLog /var/log/apache2/drupal_error.log

</VirtualHost>

And on my .htaccess either i comment or uncomment the RewriteBase line, same results. 在我的.htaccess上,我评论或取消注释RewriteBase行,结果相同。

Try solution from here: 从这里尝试解决方案:

https://drupal.stackexchange.com/questions/241761/how-do-i-run-a-site-from-a-sub-directory https://drupal.stackexchange.com/questions/241761/how-do-i-run-a-site-from-a-sub-directory

That is: 那是:

<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteCond %{REQUEST_URI} !drupal/
  RewriteRule (.*) /drupal/$1 [L]
</IfModule>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM