.htacces 重写到没有通配符 dns 的子域

发布于 2024-10-08 02:05:45 字数 521 浏览 0 评论 0原文

我用谷歌搜索了很多,也尝试了一些我找到的解决方案。不幸的是没有成功。我的问题:对于 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

向日葵 2024-10-15 02:05:45

是的,这是行不通的。主要是因为子文件夹地址是硬编码在博客地址中的。

您可以尝试两件事:

  • 手动创建子域并在 WordPress 安装时为其指定文档根目录,
  • 使用域映射插件将子域映射到子文件夹。仍然需要将每个子域作为服务器别名添加到与 wordpress 相同的文件夹中。

Yeah, it's not gonna work. Mostly becasue the subfolder address is hardcoded in the blog address.

two things you can try:

  • make manual subdomains and pint the docroot for it at the wordpress install
  • use the domain mapping plugin to map subdomains to the subfolders. still gotta add each subdomain as a server alias to the same folder as wordpress.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文