Closed jshih-webmaster closed 8 years ago
Did you install WordPress in a subdirectory? Take a look at your wp-config.php and look for the section that sets custom paths. It looks like this probably:
/**
* Set custom paths
*
* These are required because wordpress is installed in a subdirectory.
*/
if (!defined('WP_SITEURL')) {
define('WP_SITEURL', 'http://' . $_SERVER['SERVER_NAME'] . '/wordpress');
}
if (!defined('WP_HOME')) {
define('WP_HOME', 'http://' . $_SERVER['SERVER_NAME'] . '');
}
if (!defined('WP_CONTENT_DIR')) {
define('WP_CONTENT_DIR', dirname(__FILE__) . '/content');
}
if (!defined('WP_CONTENT_URL')) {
define('WP_CONTENT_URL', 'http://' . $_SERVER['SERVER_NAME'] . '/content');
}
Yup, I did install WordPress in a subdirectory. The custom paths in the wp-config.php has the same configuration as above. But where can I change the WP_SITEURL and WP_HOME ?
@jshih-webmaster You will need to change it in your wp-config.php
. Since it is defined here, it will essentially ignore whatever is set in the database and dynamically set the URLs using the schema in wp-config
.
For a subdirectory install, the code above should look like this:
/**
* Set custom paths
*
* These are required because wordpress is installed in a subdirectory.
*/
if (!defined('WP_SITEURL')) {
define('WP_SITEURL', 'http://' . $_SERVER['SERVER_NAME'] . '/DIRECTORY/wordpress');
}
if (!defined('WP_HOME')) {
define('WP_HOME', 'http://' . $_SERVER['SERVER_NAME'] . '/DIRECTORY');
}
if (!defined('WP_CONTENT_DIR')) {
define('WP_CONTENT_DIR', $_SERVER['DOCUMENT_ROOT'] . '/DIRECTORY/content');
}
if (!defined('WP_CONTENT_URL')) {
define('WP_CONTENT_URL', 'http://' . $_SERVER['SERVER_NAME'] . '/DIRECTORY/content');
}
DIRECTORY
should be your subdirectory where your site is installed. So for your case it would be yeopress
. Also note the change to dirname(__FILE__)
. For subdir install it should be $_SERVER['DOCUMENT_ROOT']
.
You may also need to change the references to wordpress
and content
, depending on what you have named those two directories.
Let us know if those changes take care of it for you.
Thanks Toddses! That solved my problem.
Great news!
I want to update my initial installed site url (http://yeopress.localhost) to (http://localhost/yeopress)
I've updated all my in original site url in the database to the new url. However in the admin 'general settings', you can still see both 'Wordpress Address (URL)' and 'Site Address (URL)' shows the old original URL. I'm unable to change them inside the admin 'general settings' because they are disabled (grey out).
Do you know how I can change it?