簡體   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