After migration of WordPress website I can't access the admin (white page)
Thaks to: https://stackoverflow.com/
I am trying to move a WordPress site from my local server to the online server.
The problem is that, after the migration, if I try to open the administration page (wp-admin) I only obtain a white page, as you can see here: http://scorejava.com/wordpress/wp-admin/. Everything else seems work well in the homepage: http://scorejava.com/wordpress/.
In my local web server I have the WP site into the folder: /var/www/wordpress
. I have moved it into a wordpress folder that is into my root directory of my online web server.
I have also import the local database into the onlyne database using MySql and then I have use the Search and Replace for WordPress Databases Script to change automatically all the http://localhost/wordpress
occurrence into the database tables with http://scorejava.com/wordpress/.
SOLUTIONS:
WordPress URLs
When migrating WordPress sites where the URL changes, you will need to tell WordPress about the new URL. WordPress stores that information in the database, so if you're comfortable with that, you could find the correct entry in the wp_options
table in your database and update its value.
I will show some fixes for standard WordPress installs (where the site URL is the WordPress root), but you may need to use different values for home
and siteurl
if you have a different setup.
Fix URLs via SQL
Get current values of siteurl and home using options table name, wp_options in the case
Sometimes when there are problems and the user can’t login, or working on a migration, it may help to check and update the correct values in the database. Use https in values if using https! First we query to see the existing values.
$ mysql> select * from wp_options where option_name=‘siteurl’ or option_name=‘home’;
±----------±------------±-----------------------±---------+
| option_id | option_name | option_value
±----------±------------±-----------------------±---------+
| 2 | home | http://pjova.reclaim.hosting/wp
| 1 | siteurl | http://pjova.reclaim.hosting/wp
±----------±------------±-----------------------±---------+
2 rows in set (0.00 sec)
update values of siteurl and home to same value
For this article we are just using the value ‘TEST’ to see how it works.
$ mysql> update wp_options set option_value=“TEST” where option_name=‘home’ or option_name=‘siteurl’;
±----------±------------±-------------±---------+
| option_id | option_name | option_value | autoload |
±----------±------------±-------------±---------+
| 2 | home | TEST | yes |
| 1 | siteurl | TEST | yes |
±----------±------------±-------------±---------+
2 rows in set (0.00 sec)
You will need to update the relevant fields in the DB, those being the entries of wp_options
where the option_name
is siteurl
or home
. You can find these fields using phpmyadmin, mysql-workbench, or another database management tool, or you can use the following query, changing the URL to be your own.
UPDATE `wp_options` SET `option_value`='http://www.myurl.com' WHERE `option_name` IN ('siteurl', 'home');
Fix URLs via wp-config.php
However, you can also do this via wp-config.php
, which I find to be much more comfortable. Just open wp-config.php
and add the lines:
// Site URLS (override DB settings)
define('WP_HOME','http://www.myurl.com'); //<-- NO TRAILING /
define('WP_SITEURL','http://www.myurl.com'); //<-- NO TRAILING /
Obviously you'll need to supply your correct URL.
It's possible that this is the only error you're having, and after adding those lines to wp-config.php
, you will be able to log in and use your site normally.
Debugging WordPress errors
However, if you continue to experience problems, and any time you're working on developing a website, you will want to see error output. You can check your server logs for information about the errors, but you may find it more convenient for WordPress to simply display the errors in the page. To enable error display, change the following setting to true
in wp-config.php
.
define('WP_DEBUG', true);
Now WordPress will display any errors it encounters directly in the webpage. Be sure to change the setting to false
for use on a production site.
Working with wp-config.php
This file will be located in the root directory of your wordpress installation. To make any of the changes mentioned here, you may either edit the file directly on the server (via ssh
for example), or download the file with an FTP client, make your changes using a text editor, and upload the file again.
It's also a good idea to keep a backup copy before making any changes in case you break something while you're working.
References
You can read all about changing the WordPress site URL on the docs page.
Comentarios
Publicar un comentario
Dime si la información de este blog te sirvio.