I have tried copying my wordpress site to my PC for editing offline using WAMP. I followed the following tutorial word for word.
How to create a local copy of a wordpress site
I have placed my files in C:wampwwwwordpress
I saw somewhere about adding the following to the wp-config.php but it still points to my website.
define('WP_HOME','http://localhost/wordpress');
define('WP_SITEURL','http://localhost/wordpress');
I am 100% sure that wp_options table in my database only references http://localhost/wordpress
so where is it getting my live site address from?
UPDATE 1:
I just noticed the following in the bottom of my wp-config.php
/**
* For developers: WordPress debugging mode.
*
* Change this to true to enable the display of notices during development.
* It is strongly recommended that plugin and theme developers use WP_DEBUG
* in their development environments.
*/
define('WP_DEBUG', false);
define('WP_ALLOW_MULTISITE', true);
define( 'MULTISITE', true );
define( 'SUBDOMAIN_INSTALL', false );
$base = '/';
define( 'DOMAIN_CURRENT_SITE', 'www.mywebsite.co.uk' );
define( 'PATH_CURRENT_SITE', '/' );
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 );
/* That's all, stop editing! Happy blogging. */
/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');
/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');
where it says
define( 'DOMAIN_CURRENT_SITE', 'www.mywebsite.co.uk' );
(obviously changed my address for posting) if I change it too
define( 'DOMAIN_CURRENT_SITE', 'localhost/wordpress' );
I get a redirect loop. Is this related or am I changing something I don’t need to and the issue is else where?
UPDATE 2: does it having anything to do with the fact that on my website the wordpress files are in the www
folder and on the local they are in the www/wordpress
folder?
I have found the answer… well to my situation anyway. It was something related to multisite. Removing the following from
wp-config.php
got it to work for me.Removed
Although I had mine setup for multisite I wasn’t really using it so I thought I would try and set it up as single site. As soon as I tried the above it worked.
Update
Instead of find-replace string using Notepad++ (or any editor) a better way would be to use a plugin which does the same job in a safer way â a way where the serialized data would be intact during the migration:
Use plugin like the Velvet Blues Update URLs. The plugin can be used for migration from localhost to live server or vice versa. Josh Hall has a video on that:
ð¬ Video: How to MANUALLY Migrate Your WordPress Site – Josh Hall
I follow an easy process taught by my colleague and teacher Ms. Tahmina Aktar. The process is:
From webserver to localhost migration
From the server cPanel File Manager:
.zip
file into your local server (for WAMP, it’swww
), and Uncompress it..sql
file. (i.e.mysql.sql
)mysql.sql
file with tables and data into NotePad++ (Because NotePad++ won’t make your system lazy or idle even if the DB is huge)Now press
Ctrl + F
to Find, and on the text box, type: “http://www.mywebsite.co.uk
” and then click on the Replace tab, and type: “http://localhost/mywebsite
“.Now find and replace individually or you can find & replace all.
And then Save the file
mysql.sql
.Step VI: Make a new database (i.e.
my_db
) in your local server (i.e. WAMP PHPMyAdmin), and Import themysql.sql
into the db.Step VII: Open the
WP-Config.php
into your editor, and change the following lines into:/** The name of the database for WordPress */
define(‘DB_NAME’, ‘
my_db
‘);/** MySQL database username */
define(‘DB_USER’, ‘root’);
/** MySQL database password */
define(‘DB_PASSWORD’, ”);
From localhost to web server migration
If you need to launch your site to the web from the localhost, just follow the procedure alternatively.
Let’s talk about your problem:
Now, you got the idea of how you can manage your database for the local server and the remote server simply by replacing the relative URLs in the correct form and directory path. So, you can search your DB in NotePad++ if there are any web-related mentions there, you need to replace.
Good luck. 🙂
Try logging in to the local WP installation as an admin. Now go to the dashboard, click “Settings” and change “WordPress Address (URL)” and “SiteAddress (URL).” Make sure you’re logging in to the local WP database and not the live one!
My suggestion is download all your files associated with site as a zip and extract to localhost.
Add a plugin named wp-migrate. http://wordpress.org/plugins/wp-migrate-db/ ativate it.
Go to Tools -> Migrate DB
Enter your localhost url in the place of new address.No ‘/’ required at the end.
New file path as the path in local system: eg: D:wampwww
Click on Export Database.
Create a database and import the sql that your exported using the plugin to the created database.
Change the host, databasename, db username and dbpassword in wp-config file.
I just had the same exact issue, add a / to the end of your site url and home in your config and database, also check for whitespace at the end of your config file and remove it.
For a multi-site setup check your wp_blogs table. The domain field there likely contains a reference to your live site and is the culprit.