Change the folder name for the directory WordPress

2019-01-19 05:18发布

问题:

I just installed WordPress in a subfolder on my site (http://www.example.com/wordpress/) and I want to change the folder name from "wordpress" to "blog". I've already gone through the entire installation process, but have not made any customizations at all yet.

I tried just renaming the folder on the server, and the blog page does load, but some of the content was missing (the main, default header image, most notably), so I'm assuming there are other files that need to know the directory name as well.

If this is even feasible/possible without a complete reinstall, how do I change the folder name of a new WordPress installation?

回答1:

I'm pretty sure you have to also change it in the database before you go changing the folder name. Try going to settings->general in your wp-admin area and it'll be one of the first few input fields there.

So, change those two fields, save (the page might not come back however), then change the folder name.



回答2:

Step 1 :

Go to settings->general and update your Site Address (URL) and WordPress Address (URL) to http://example.com/new_folder_name


step 2 :

Rename the folder name from wordpress to blog


step 3 :

Add this to wp-config.php file :

define('WP_HOME','http://example.com/new_folder_name'); define('WP_SITEURL','http://example.com/new_folder_name);

Please clear your browser cache and relogin.



回答3:

You don't have to touch the database settings. And all the instructions at codex (http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory) are overly complex. Believe it or not, ehow.com has the best step-by-step answer for this task:

http://www.ehow.com/how_6558163_changing-wordpress-directory-name.html