.htaccess - htaccess - 子目录上的域重定向 - 缺少子目录名称
问题描述
我有几个域名。我想将它们全部重定向到主域。
RewriteCond %{HTTP_HOST} ^example\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.example\.com$
RewriteRule ^(.*)$ "https\:\/\/target\.net\/$1" [R=301,L]
子目录.htaccess
是为了虚拟路由而设置的(在index.php
文件中处理),它看起来像这样:
Options -MultiViews
RewriteOptions InheritBefore
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
但是子目录名称在重定向过程中没有“通过”。例如:
example.com/thedir/2020/x/y/z 将重定向到: target.net/2020/x/y/z
这是为什么?
谢谢
解决方案
推荐阅读
- reactjs - 如何在 reactjs 中集成 bootstrap 4 数据表?
- sendgrid - 我们可以限制电子邮件链接在 Sengrid 中编码吗?
- r - 如何将所有组设置为等于具有最小组长度(行数)的组?
- ios - 在 TableView 控制器中将视图显示为内部应用程序通知
- daml - 如何在 DAML 中为原始类型和记录指定默认值?
- python - 分组排除异常值的最有效方法是什么
- java - 需要解释 Java 中的行选择
- javascript - 从 vue 导入 {ref} 时出错?
- jquery - 使用jquery的Bootstrap Modal设置ID不起作用
- append - 函数中使用的全局变量是否需要在 def 块之前定义?