2016-07-25 181 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