.htacces 重写到没有通配符 dns 的子域
我用谷歌搜索了很多,也尝试了一些我找到的解决方案。不幸的是没有成功。我的问题:对于 WordPress 安装,我无法进行子域设置,因为我无法在服务器上激活通配符 DNS。这使我在主域和两个子目录上设置了 WordPress 网络安装,如下所示:
域名.be
domain.be/alpha
domain.be/beta
,我可以在我的服务器上设置子域,因此我设置了以下
alpha.domain.be
beta.domain.be
我现在尝试使用 .htaccess 来重写它,这样访问domain.be/alpha 的人就会自动重定向到 alpha.domain.be - 显然对于第二个(测试版)子目录。据我所知,我应该能够在不使用 dns 通配符的情况下完成此任务。不幸的是,我对 .htaccess 规则缺乏经验,无法完成此任务。有谁可以帮我解决这个问题吗?
如果您对这个设置有疑问,我也有兴趣听听。
I've googled around quite a bit and also tried some of the solutions I've found. Unfortunately without success. My problem: For a Wordpress install I couldn't do a subdomain setup since I couldn't activate wildcard DNS on my server. This made me set up my Wordpress network install on the main domain and on two subdirectories as below:
domain.be
domain.be/alpha
domain.be/beta
I can however make set subdomains on my server, so I set up the following:
alpha.domain.be
beta.domain.be
I'm now trying to use .htaccess to rewrite this, so that people who go to domain.be/alpha are automatically redirected to alpha.domain.be - and obviously the same for the second (beta) subdirectory. As far as I can see, I should be able to pull this off without using dns wildcards. Unfortunately, I'm too inexperienced with .htaccess rules to pull this off. Anyone out there who can help me with this?
If you have your doubts about this set-up, I'm also interested in hearing about it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,这是行不通的。主要是因为子文件夹地址是硬编码在博客地址中的。
您可以尝试两件事:
Yeah, it's not gonna work. Mostly becasue the subfolder address is hardcoded in the blog address.
two things you can try: