更改wordpress栏目地址,更改URL地址

如果你的网站下面有个二级目录xxx/wordpress/  想换成根目录下的URL,或者你的网站的URL想指向一个子目录等这篇文章会帮助到你。

二级目录换成更目录
1.进入wp后台General设置url(Site Address (URL))改成根目录网址
2.复制index.php 和.htaccess(设置permalinks后才会有这个文件,ftp默认隐藏的)到根目录下
3.改’./wp-blog-header.php’ 成’./wordpress/wp-blog-header.php’
4.ok

另外一种情况类似,官方参考网网址:http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory

原文:

Using a pre-existing subdirectory install
If you already have WordPress installed in its own folder (i.e. http://example.com/wordpress) then the steps are as follows:

Go to the General panel.
In the box for Site address (URL): change the address to the root directory’s URL. Example: http://example.com
Click Save Changes. (Do not worry about the error message and do not try to see your blog at this point! You will probably get a message about file not found.)
Copy (NOT MOVE!) the index.php and .htaccess files from the WordPress directory into the root directory of your site (Blog address). The .htaccess file is invisible, so you may have to set your FTP client to show hidden files. If you are not using pretty permalinks, then you may not have a .htaccess file. If you are running WordPress on a Windows (IIS) server and are using pretty permalinks, you’ll have a web.config rather than a .htaccess file in your WordPress directory. As stated above, copy (don’t move) the index.php file to your root directory, but MOVE (DON’T COPY) the web.config file to your root directory.
Open your root directory’s index.php file in a text editor
Change the following and save the file. Change the line that says:
require(‘./wp-blog-header.php’);
to the following, using your directory name for the WordPress core files:
require(‘./wordpress/wp-blog-header.php’);
Login to your site. It should still be http://example.com/wordpress/wp-admin/
If you have set up Permalinks, go to the Permalinks panel and update your Permalink structure. WordPress will automatically update your .htaccess file if it has the appropriate file permissions. If WordPress can’t write to your .htaccess file, it will display the new rewrite rules to you, which you should manually copy into your .htaccess file (in the same directory as the main index.php file.)

发表评论