繁体   English   中英

如何设置wordpress(Windows托管)页面/部分以使用子域?

[英]How can I set a wordpress(windows hosting) page/section to use a subdomain?

我已经在网络上进行了很多研究,但没有找到适合我的具体情况的文件(实际上,到目前为止还没有任何结果)。 假设我在domain.com上有一个wordpress网站。 我有一个部分/页面,我将其称为测试页。 我需要将其设置为使用testpage.domain.com。 如标题所示,这是Windows托管。 我尝试了以下操作: 1)我在web.config中添加了以下规则:

<rule name="Rewrite sub-domain to dir" enabled="true">
    <match url="^(.*)$" />
    <conditions>
        <add input="{HTTP_HOST}" pattern="^testpage\.domain\.co\.uk$" />
    </conditions>
    <action type="Rewrite" url="testpage/{R:1}" />
</rule>

2)我创建了子域并将其设置为/ testpage,然后在testpage中,使用以下代码放置了index.php:

<?php
/**
* Front to the WordPress application. This file doesn’t do anything, but loads
* wp-blog-header.php which does and tells WordPress to load the theme.
*
* @package WordPress
*/

/**
* Tells WordPress to load the WordPress theme and output it.
*
* @var bool
*/

$_GET[‘page_id’]=4323;

define(‘WP_USE_THEMES’, true);

/** Loads the WordPress Environment and Template */
require(‘../wp-blog-header.php’);

我从wordpress取得ID。

我不是编码人员,虽然我在这两种情况下都可以理解一些代码,但我距离专家还很远,我不能肯定地说那里没有错误。 但是这些方法都不适合我。 方法1将加载testpage.domain.com/testpage,而不只是testpage.domain.com 方法2将可以工作,但仅加载主页,而不是我在代码中放入其ID的页面。

我非常感谢任何对此感兴趣的人。

我的朋友,我建议您切换到Linux托管,您可以在其中进行适当的重定向。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM