移动到localhost的虚拟域时设置Wordpress基本URL?

I had a project on localhost, now in wamp I setted virtual domain. Now the local project opens fine on domain address but resource files on pages are not loading. In source code of pages css and js files are still linked with 'localhost' hence are not found.

Its very simple

Edit wp-config.php

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

Edit functions.php

and add the line

<?php
update_option('siteurl','http://example.com');
update_option('home','http://example.com');
?>

Take care of permalinks .htacess file & database resources links

You can check here

In your wp-config.php, add these two lines.

define('WP_HOME','sitename/');
define('WP_SITEURL','sitename/');

Also, you need to edit the SQL file to change the resource locations.

I wrote this tutorial which shows you how to do that.

It's here, on my blog.

Try this:

You need to change your local links to live links. For that, Update your database with some query.

:: Queries to change URL for WP Website

UPDATE pvgc_options
SET option_value = replace(option_value, 'http://pleasantviewgarden.hideoutdev.co.uk/',
                           'http://pleasantviewgardencentre.com/')
WHERE option_name = 'home' OR option_name = 'siteurl';

UPDATE pvgc_postmeta
SET meta_value = replace(meta_value, "http://whynickoli.com/", "http://localhost/onestopproperty/");

UPDATE pvgc_posts
SET guid = REPLACE(guid, "http://whynickoli.com/", "http://sparsh-technologies.co.in/megha/onestopproperty/");

UPDATE pvgc_posts
SET post_content = REPLACE(post_content, "http://whynickoli.com/",
                           "http://sparsh-technologies.co.in/megha/onestopproperty/");

Here you should use your domain.

Thanks!

Edit the wp-config.php settings for a new domain:

define('WP_HOME','siteurl');
define('WP_SITEURL','siteurl');

Search and replace on the database with InterconnectIT Search and Replace Tool. With that tool it's easy to search through the entire database for all occurrences of old domain, and replace that with the name of new domain

If you want to maintain your ability to upgrade WordPress in one click, never edit the WordPress core code. Instead, you can use their recommended (clean "drop-in") solution:

Create a new file at /wp-content/db.php with this content:

<?php

/**
 * @see http://codex.wordpress.org/Running_a_Development_Copy_of_WordPress
 */
add_filter('pre_option_home', 'test_localhosts');
add_filter('pre_option_siteurl', 'test_localhosts');

function test_localhosts()
{
    if (isDevEnvironment($_SERVER)) {
        return "http://mysite.local/blog"; //Specify your local dev URL here.
    } else {
        return false; // act as normal; will pull main site info from db
    }
}

/**
 * Logic to determine the environment (dev or prod)
 * @return bool 
 */
function isDevEnvironment($serverArray)
{    
    return strpos($serverArray['SERVER_NAME'], 'mysite.local') !== false;//Edit this function such that it returns a boolean based on your specific URL naming convention.
}

Now, your local development environment will use its own base URL, and then when you deploy a copy of your codebase to a production environment, it will use its production base URL automatically.