Method of moving WordPress blog from route to subdirectory

I had made the blog of WordPress in the root directory of the domain up to now. However, when it is the state as it is, the route file does the lash-up and it becomes hard to see. Moreover, it becomes difficult to use when being use it as homepage space in the future. Then, the blog decided to be moved from the route to the subdirectory.

The address of the blog also changed to the subdirectory. The blog uses the data base named MySQL. Therefore, the blog cannot be easily moved like the movement of the homepage. When it makes a mistake in the way, it is possible that the blog disappears.

Method of backing up WordPress blog

First of all, the data base of the WordPress blog is backed up. This preserves the data base on the management screen of Coreserver.jp. About 18MB was able to be filed in the upstairs layer of public_html "Mysql_.**********.dump". (About 100 contribution numbers)

Next, data is exported from the tool of the management screen of the WordPress blog. This downloads data to the personal computer. It was about 500kB file by the file name like "wordpress.2010-11-15.xml".

The folder of the word press also downloads the mirroring with the FTP software (FFFTP etc.) for attention. It is possible to download it by the FTP because there is no picture file in the data base.

An official site where it explained the procedure for moving the blog to the subdirectory is in the following place. It stumbles in actually various places though it is written here that it is possible to do easily. A person not confident will stop it.

http://wpdocs.sourceforge.jp/Giving_WordPress_Its_Own_Directory

After all, I decided to try by projecting ahead though I also hesitated severely. Next, the method experienced by me is described.

The blog of the root directory The method of the movement to "hoge.jp/wp/"

To move the WordPress file to special directory wp when WordPress has been installed in the root directory, as follows is done.

A general, set panel is opened from "Setting" with the administration panel of the blog. Address (URL) column of WordPress is changed to URL of new WordPress.

Address of WordPress (URL): "http://hoge.jp/wp"

The address of the blog The (URL) column is also new WordPress It changes to URL. Keeping to the same is and there will not be problem in the future.

The change is clicked and preservation (Update Options) is clicked. (At this point, it doesn't worry even if the error message comes out. )

The WordPress file is moved to made new directory (WordPress address). Here, it makes it to not the copy but the movement.

The WordPress directory The index.php file is opened with the text editor. The following correction is done, and it saves a file.
Before it corrects it: require('./wp-blog-header.php');
After it corrects it: require('./wp/wp-blog-header.php');

It logs it in from new URL. "http://hoge.jp/wp/wp-admin/"

Please open the permalink setting panel when you set the permalink, and update the permalink structure. .WordPress : in the automatic operation if the proper permission is set to htaccess. Htaccess is renewed.

It is not it is possible to hold this. Please review the permission of each folder and the file. Moreover, when the PHP file in the theme has been changed, it is necessary to change in the address in this.

Setting of permanent move of page

It moved from "http://hoge.jp/" to "http://hoge.jp/wp/". It forwards like the current address and it is displayed. The following line is added to the htaccess file of the route. I made it only to not the addition but these two lines.

RewriteEngine on 
RewriteRule ^(.*)$ /wp/$1 [L,R=301]

Here, "R=301" is to mean a permanent move. The access to http://hoge.jp/is forwarded to http://hoge.jp/wp/ and the display address is http://hoge.jp/wp/ .

The access to "http://hoge.jp/" is forwarded to "http://hoge.jp/wp/" when there is no "R=301". The display address is "http://hoge.jp/".

The following line is added to the htaccess file of the "hoge.jp/wp/" directory because the way things are going, there will be a possibility of the endless loop.

RewriteEngine Off

A safe method of no permanent loop : to the route The content is set making the index.php file as follows. In a word, it only forwards it to/wp/In this case, it is forwarded to/wp/when there is only an access in http://hoge.jp/ Forwarding is not done even if there is personally an access in the blog.

<html>
<head>
<meta HTTP-EQUIV="Refresh" CONTENT="0;URL=http://hoge.jp/wp/">
</head>
</html>

Method of change as WordPress image is displayed

Because the WordPress image will not be displayed the way things are going, it changes like displaying the image next. The image is an absolute address from http.

The editor corrects the content of data "wordpress.2010-11-15.xml" to which data is exported from the tool of the management screen of the blog a little while ago. The editor uses the one corresponding to the character-code of utf-8 like TeraPad. It is not possible to do in the note pad.

The corrected content does as follows. "http://hoge.jp/" is substituted for "http://hoge.jp/wp/".

Next, all the contributions are deleted from the contribution of the management screen of the blog, and it deletes it from the garbage box. If this is not done, data cannot be overwrited. Should I delete the category and it is not possible to know. Because I did not delete the category, the category has been doubly registered.

Next, the import of data is done from the tool of the management screen of the blog. Maybe, it is sure to go well by this. Please do carefully above.