如何使用root .htaccess文件重定向子域?
我的目标是编辑域的.htaccess文件,例如 example.com ,添加各种URL重定向,以便:
- apple.example.com to example.org/subdomain1
- pear 。
-
-
同样,我只想编辑root .htaccess文件。谢谢!
My goal is to edit the .htaccess file of a domain, for example, example.com, to add a variety of URL redirects such that:
- apple.example.com goes to example.org/subdomain1
- pear.example.com goes to example.org/subdomain2
- strawberry.example.com goes to example.org/subdomain3
- banana.example.com goes to example.org/subdomain4
How would I do this? Again, I only want to edit the root .htaccess file. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用mod_rewrite:
上述重定向
https://apple.example.com/
https://example.org/subdomain1
根据您的第一个示例。等。
参考
Using mod_rewrite:
The above redirects
https://apple.example.com/
tohttps://example.org/subdomain1
as per your first example.Etc.
Reference
RewriteRule
DirectiveRewriteCond
Directive