apache - 虚拟主机重定向在 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#redirect,Redirect
重定向以给定 URL 开头的任何请求。
您可能想RedirectMatch
改用:
RedirectMatch permanent "^/$" http://team.xyz.ae/users/login
推荐阅读
- r - 如何避免模块代码过早运行?
- botframework - 使用 BotFramework 的 WebChat 自动完成
- hyper-v - Hyper-V 在睡眠后断开增强会话
- asp.net-mvc - Sitefinity 如何让自定义用户控件仅在预览/实时模式下显示
- java - Apache Lucene for Java:IndexWriter.addDocument 与 addDocuments(速度)
- stripe-payments - 连接帐户的 Stripe Checkout 给出“Invalid payment_page id”错误
- python - 从 python 字典自动生成 BigQuery 架构
- swift - Firebase 请求方法后的 Object = nil
- regex - 正则表达式:如何否定一组单词跟随一个单词?
- python - BASIC语法中“END”和“END IF”之间的冲突,使用Lark