如何将子域映射到 WordPress 帖子?
有点奇怪的问题,我希望我的 WordPress 博客使用子域作为永久链接,有点像流行的网站“设置”。
我已经将 Apache 配置为加载站点,无论子域如何,我只需要弄清楚如何让 Wordpress 加载正确的帖子。我将永久链接结构设置为“/%postname%/”,因为我将手动确保帖子名称是唯一的。
我需要解决的只是如何将子域映射到帖子名 - 我猜它需要 mod_rewrite?但我不确定如何继续。
谢谢
Slightly strange question, I want my Wordpress blog to use subdomains as permalinks, a bit like the popular website "The Setup".
I already have Apache configured to load the site irrespective of the subdomain, I just need to work out how to make Wordpress load the right post. I have my permalink structure set as "/%postname%/" as I will manually ensure the post names are unique.
All I need to work out is how to get the subdomains mapped to the postname - I'm guessing it requires mod_rewrite? But I'm unsure how to proceed.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我使用 nginx 进行设置,所以我不确定这是否会对您有很大帮助(我也不能保证这是最好的方法),但我的配置如下所示:
I'm using nginx for The Setup, so I'm not sure if that will help you much at all (nor can I guarantee that this is the best way to do it) but my config looks something like this:
使用 Wordpress 核心功能实现此目的的最佳方法似乎是“创建网络”功能 - 以前称为 Wordpress 多站点 (MU)。
您所要做的就是在 wp-config.php 文件中添加一行,以从 Wordpress 仪表板开始设置选项。
这里有详细信息: http://codex.wordpress.org/Create_A_Network
但是,请注意,此时就屏幕外观和工作流程而言,它们稍微过时了。 (例如,完成该过程后,现在不再从管理破折号栏中的左上角链接进入网络管理界面,该链接位于右上角,看起来有点不同)。
The best way to accomplish this with Wordpress core features seems to be the "Create a Network" feature - formerly Wordpress Multi-Site (MU).
All you have to do is add a line to your wp-config.php file to begin the setup options from the Wordpress dashboard.
There are details here: http://codex.wordpress.org/Create_A_Network
However, be advised that at this time they are slightly out of date in terms of what the screens look like, and the workflow. (For example, once you've gone through the process, now instead of entering the Network Admin interface from the top left link in the admin dash bar, the link is in the top right and looks a bit different).