代码之家  ›  专栏  ›  技术社区  ›  Soubhagya Kumar Barik

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

  •  0
  • Soubhagya Kumar Barik  · 技术社区  · 7 年前

    我创建了一个简单的虚拟域 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 回复  |  直到 7 年前
        1
  •  1
  •   Alan Birtles    7 年前

    https://httpd.apache.org/docs/2.4/mod/mod_alias.html#redirect 我是说, Redirect 重定向以给定URL开头的任何请求。

    你可能想用 RedirectMatch 相反:

    RedirectMatch permanent "^/$" http://team.xyz.ae/users/login
    
    推荐文章