.htaccess - 将目录重定向到子域
问题描述
我根本想不通,有谁知道如何描述一个链接.htaccess
:
example.com/bedrijven/marketing-metrics/
至
marketing-metrics.example.com/
我在这个论坛上找到了这个,但这不是解决方案
RewriteRule ^(bedrijven/$1.*)$ https:///$1.example.com/ [R=301,L,NC]
有没有人可以帮忙?
解决方案
请尝试以下方法:
RewriteRule ^bedrijven/([^/]+)/$ https://$1.example.com/ [R=301,L,NC]
这$1
是对RewriteRule
模式中第一个捕获组(第一个参数)的反向引用,即。任何匹配的([^/]+)
. 正如您在示例中使用的那样,在RewriteRule
模式本身中使用这样的反向引用是没有意义的。
推荐阅读
- mysql - 我已经尝试过任何方法。无法授予超级特权我尝试设置 log_bin_trust_function_creators
- swift - Swift 将 makeConnectable 与 PassthroughSubject 结合起来
- r - 安装 R 包 'statnet.common' 时编译失败
- r - 从 Github 安装 R 包的问题(非零退出状态?)
- python - sqlalchemy-datatables TypeError:Customer类型的对象不是JSON可序列化的
- python - Python Map、Lambda 和 string.replace
- google-apps-script - 谷歌表格如何制作粘贴相对范围的宏
- python - 对 mysql 数据库密码和主机使用环境变量会引发错误
- mysql - 当我在我的帖子上插入新评论时,如何在 MYSQL 中触发充当计数器
- java - 仅将两个 ArrayList 组合成一个数组