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

时间:2018-07-13 06:40:43

标签: apache httpd.conf virtual-hosts

我已经创建了一个简单的虚拟域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>

1 个答案:

答案 0 :(得分:1)

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

您可能想改用RedirectMatch

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