2016-07-25 172 views
0

假設我有www.example.com/uglytext作爲我的主頁。有沒有辦法可以將它更改爲www.example.com/nicetext,同時仍然將uglytext作爲目錄名稱,並且實際上仍在後臺導航至www.example.com/uglytext?WordPress更改網站的網址名稱(不更改實際的網址)

我目前的htaccess:

# BEGIN WordPress 
<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase /mobile_dev/ 
RewriteRule ^index\.php$ - [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /mobile_dev/index.php [L] 
</IfModule> 

# END WordPress 

我需要mobile_dev是移動的。 www.mysite.com/mobile而不是www.mysite.com/mobile_dev

回答

0

在你wp-adminSettings > General下有兩種選擇:

  • WordPress Address (URL)(相當於siteurlwp_options表中您的數據庫)
  • Site Address (URL)(對應於home在同一個表)

您可以設置WordPress Address (URL)http://www.example.com/uglytextSite Address (URL)http://www.example.com/nicetext以實現您想要的結果。

欲瞭解更多信息,你可以檢查這個WordPress Codex page解釋移動核心WordPress文件和更詳細地維護URL的過程。

+0

謝謝。我離開了atm站點,但由於它是舊版本的WordPress,它可能沒有站點地址(它是從2010年開始的)。不過,我明天一定會檢查一下。 –

+0

這是否會影響使用home_url()函數的代碼?根據法典,「使用home_url()獲取」常規設置「中定義的」站點地址「。」 –

+0

'home_url()'從[home]選項[內部](https://developer.wordpress.org/reference/functions/get_home_url/)獲取URL,因此它將與您分配的站點地址一致。如果你想獲得'siteurl',你可以使用[site_url()](https://codex.wordpress.org/Function_Reference/site_url)函數。 – akesfeden