【发布时间】:2022-10-13 21:25:06
【问题描述】:
目标
fharrell.com/* 被域名提供商重定向到hbiostat.org/blog/*。我想保持地址栏显示fharrell.com/*
Apache2 设置
-
/etc/apache2/apache2.conf是标准的,但有以下例外:
<Directory /home/ubuntu/htdocs/>
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>
-
/etc/apache2/sites-enabled/hbiostat.org.conf与/etc/apache2/sites-available/hbiostat.org.conf符号链接 -
hbiostat.org.conf将文档根设置为/home/ubuntu/htdocs已经运行了一段时间 -
hbiostat.org.conf的内容:
<VirtualHost *:443>
ServerAdmin my@email.address
DocumentRoot /home/ubuntu/htdocs
ServerName hbiostat.org
ServerAlias www.hbiostat.org
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /home/ubuntu/htdocs>
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>
<Directory /home/ubuntu/htdocs/blog>
RewriteEngine on
RewriteBase /
RewriteRule ^hbiostat\.org/blog$ fharrell.com [R]
</Directory>
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/hbiostat.org/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/hbiostat.org/privkey.pem
</VirtualHost>
<VirtualHost *:80>
ServerName hbiostat.org
ServerAlias www.hbiostat.org
DocumentRoot /home/ubuntu/htdocs
<Directory /home/ubuntu/htdocs/blog>
RewriteEngine on
RewriteBase /
RewriteRule ^hbiostat\.org/blog$ fharrell.com [R]
</Directory>
</VirtualHost>
使用sudo apachectl -t 检查系统税。
我使用 sudo a2enmod rewrite 检查了 mod rewrite 是否处于活动状态,并使用 sudo systemctl restart apache2 重新启动了服务器
但这没有任何效果,hbiostat.org/blog/* 仍保留在地址栏中。
试过:
stackoverflow.com(包括下面的两个)和其他地方的许多补救措施,包括将命令放入.htaccess 文件(我想避免.htaccess 方法)。
任何帮助表示赞赏。
【问题讨论】: