更改基本url以允许相对链接


Changing base url to allow relative links

我有一个Wordpress站点位于子目录:

Ex. http://www.example.com/subdirectory

然而,当我在我的网站创建链接时,我必须在我的相对url中包含子目录文件夹,否则路径将不正确。这是一个问题,因为我总是在转移网站,这变得很乏味。

在创建相对url时是否有办法强制根url为http://www.example.com/subdirectory ?

例如,我想在我的页面中创建一个相对url,而不必担心包含额外的文件夹(即我想在我的页面'/wp-content/theme/20ten/images/sample.png'中这样写)

<base href="http://www.example.com/subdirectory">
或者,链接在新标签页中打开:
<base href="http://www.example.com/subdirectory target="_blank">

你应该把它添加到你的header.php的Appearance> Editor