News:
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
2012-05-19, 19:17:23

Login with username, password and session length

Pages: [1]   Go Down
  Print  
Author Topic: [HOW TO] Fix your Wordpress installation after moving into different URL  (Read 1584 times)
Piotr GRD
Administrator
Member
*****
Offline Offline

Posts: 25



« on: 2010-12-23, 10:21:59 »

If you recently moved your Wordpress installation into different URL address - different directory or different domain name - you can find a problem with your Wordpress not working correctly.

Wordpress keep the information about the URL and path inside the database, so you have to edit the values in it. It can be done inside Wordpress admin panel, but since it's currently not working for you it might be difficult. So another way is to use PHPMyAdmin or other such script that will let you edit the content of your database.

While being logged in PHPMyAdmin (or other script) and browsing your Wordpress database go into "wp_options" table. In there try to find two option values: "siteurl" and "home". Edit them to reflect new URL of your Wordpress. Without trailing slash (do NOT attach the slash / at the end of it).

If you don't know how to use PHPMyAdmin or you don't have possibility to do that, you have also different alternative. Open notepad on your computer and create a file called "anyname.php" (.php extension is important, file name can be anything you wish) with the following content:
Code:
<?php
// Wordpress wrong URLs problem fix by Piotr GRD
// It just updates the URLs inside of wp_options table in Wordpress database


// SETTINGS:
// in here put the URL where Wordpress actually is
// with NO slash at the end
// and NO www if it's on 110mb
$wp_url 'http://example.com';


// DO NOT TOUCH BELOW
include ('wp-config.php');

$con mysql_connect(DB_HOST,DB_USER,DB_PASSWORD);
if (!
$con)
  {
  die(
'Could not connect: ' mysql_error());
  }

mysql_select_db(DB_NAME$con);

mysql_query("UPDATE wp_options SET option_value = '" $wp_url "'
WHERE option_name = 'siteurl'"
);
mysql_query("UPDATE wp_options SET option_value = '" $wp_url "'
WHERE option_name = 'home'"
);

echo 
"I think its done. Check the wordpress now. And DELETE ME if succesfull.";
mysql_close($con);

?>

In the line where you see "http://example.com" type YOUR location, the URL of YOUR Wordpress. If it's inside some directory then it will be in the form of "http://example.com/directory" (no trailing slash).

Save the file and upload into the same directory on the server where your Wordpress installation is located. And then call it with your browser - in the address bar type "http://example.com/directory/anyname.php" (where "anyname.php" is your file created above).

Your Wordpress installation should be fixed. Don't forget to delete your "anyname.php" file after that.

Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by SMF | SMF © 2006-2009, Simple Machines LLC | Dilber MC Theme by HarzeM modified by Piotr GRD