虚拟主机重定向在 apache 中不起作用

Virtual host redirection not working in apache

我创建了一个简单的虚拟域http://team.xyz.ae 一旦我点击这个 URL 我想将它重定向到 http://team.xyz.ae/users/login but now its redirecting to

http://team.xyz.ae/users/loginusers/loginusers/loginusers/loginusers/loginusers/loginusers/loginusers/loginusers/loginusers/loginusers/loginusers/loginusers/loginusers/loginusers/loginusers/loginusers/loginusers/loginusers/loginusers/login

这是我为创建虚拟主机而写的

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html/xyz/
    Redirect permanent / http://team.xyz.ae/users/login
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

参见 https://httpd.apache.org/docs/2.4/mod/mod_alias.html#redirectRedirect 重定向任何以给定的 URL 开头的请求。

您可能想改用 RedirectMatch

RedirectMatch permanent "^/$" http://team.xyz.ae/users/login