【问题标题】:Virtual host redirection not working in apache虚拟主机重定向在 apache 中不起作用
【发布时间】:2018-12-21 11:27:40
【问题描述】:

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

【问题讨论】:

    标签: apache httpd.conf virtual-hosts


    【解决方案1】:

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

    您可能想改用RedirectMatch

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

    【讨论】:

      猜你喜欢
      • 2015-02-22
      • 2018-05-09
      • 2014-07-10
      • 2014-01-19
      • 2022-01-12
      • 2015-10-23
      • 1970-01-01
      • 2012-12-13
      • 2022-06-18
      相关资源
      最近更新 更多