Wordpress host IP changed - php

I've got a Wordpress site on our home intranet that has run into trouble now that the IP address has changed - The index page loads, but not the CSS and I can't log in to the site administration panel.
Unfortunately I am a bit behind on backups. Is there a way to get Wordpress to refer to the new IP address?

You have two places to update this (well three, but we'll stick with the two).
If you can still log into your admin section, type the following for your URI /wp-admin/options.php - so for example, if your site is http://localhost then your full URL will be http://localhost/wp-admin/options.php. Once you've logged into your site you should see two fields (well you'll see a lot of fields), but you'll want to look for the two with URL's in them - the Site URL and the Blog URL (in WP 2.7 the fields are labeled "home" and "siteurl", not sure on the other versions).
Or, you can log into MySQL database and run the following.
Select * from wp_options where option_name IN('siteurl','home');
I just ran this today on one of my installs. If you're option_value is set to your localhost - you can then run the following:
update wp_options set option_value='http://www.yourblogname.com' where option_name = 'siteurl';
update wp_options set option_value='http://www.yourblogname.com' where option_name = 'home';
This should update your table structure.

You have to change the 'home' and 'siteurl' in the settings. Since you cannot open the admin side of wordpress, open the database in phpMyAdmin(or something similar).
The options can be found in the 'wp_options' table(wp_ prefix might be different). Find the necessary setting using this query...
SELECT * FROM `wp_options` WHERE `option_name` IN ('siteurl', 'home')
Change the values of both the options to the new IP.

To temporarily be able to login, use this code in your wp-config.php:
define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');
or you can add this to your theme's functions.php:
update_option('siteurl','http://example.com/');
update_option('home','http://example.com/');
Warning: Updating the SQL database will be required in order for installed plugins to use the new URL/hostname. So if you use plugins modifying the database is required.

I ran into this problem before when I was migrating a site from test to production. Conveniently, MySQL has a string replace function.
Try something like this:
UPDATE wp_posts SET post_content = REPLACE(post_content,"http://localhost","http://www.myblog.com")

I ran into this problem once. Loginto your DB and check your wp_options (if wp_ is your table prefix) and then search for all records and replace your old ip with new.
Possible columns to have the old ip would be 'permalinks' etc.. Sorry I cant see my blog's table structure now otherwise I would have posted the correct column name.

Be careful for the link: https or http !!
in the command line:
mysql -u root -p
in the SQL, set new IP for xxxx
mysql> use wordpress;
mysql> select * from wp_options where option_id=1;
mysql> update wp_options set option_value="http://xxxx" where
option_id=1;
exit
Restart server

Possibly WordPress.org's coverage of this issue was not available at the time the other answers here were written, but as of now I find it more complete and easier to follow.
In my case, the method of modifying wp-config.php was only partially successful. The Relocate method described in the above web page ultimately succeeded.
Here is a synopsis of WordPress.org's coverage:
1 Changing the Site URL
1.1 Edit wp-config.php
1.2 Edit functions.php
1.3 Relocate method
1.3.1 Code function
1.3.2 Steps
1.4 Changing the URL directly in the database
2 Moving Sites
2.1 Altering Table Prefixes
2.2 Changing Template Files
2.3 Changing the Config file
2.4 Verify the Profile
2.5 Changing the .htaccess file
2.6 Additional items of note
2.6.1 Important GUID Note
2.7 Multi-site notes
2.8 wp-cli

Related

magento 1.9 store displaying css issues

I have installed a copy of my magento 1.9 store on my localhost PC as i am trying to upgrade to magento 2. I need to transfer my products to my new store. i have installed my backup on my localhost but the sites css is all messed up.
i have cleared the cache folders but this did not help, how to fix this. I need to get this working correctly before i transfer my products from magento 1 to magento 2. I can install magento 2 easily but i can not get the magento 1 store to load correctly.
How to check where is issue?
View the source of your page and click the css links, if it is pointed correctly it should bring you to the css page.
Case 1: The problem was a missing Slash "/" at the end of the domain.
Use the following to get both rows:
SELECT * FROM core_config_data WHERE path = 'web/unsecure/base_url' OR path = 'web/secure/base_url';
Then update them manually and make sure the domain has it's final "/", otherwise it will merge the domain name with the following folder name.
Case 2: Update Merge Css flag
Need go to sql manager and do this:
SELECT * FROM `core_config_data` WHERE `path` LIKE '%merge%'
Then change values from 1 to 0 Clear cache and all will be ok
Case 3 Disable rewrite rule
https://magento.stackexchange.com/questions/10961/magento-htaccess-error

website links with string auto attached

I made a new website for someone but when i tried to launch it live i had problems with links. The old version of the site had language extension.
Now every link with the domain:
sites.com get extension ( ex: www.site.com/**es**/; wwww.site.com/**en**/,www.site.com/**es**/contact)
Even thow i made dynamic links i have problems accessing the wordpressadmin and also i have problems with referencing the homepage from other pages (only way i was able to to refence the homepage was by making something like site.com#).
After every change in wordpress admin the links are adjusted with language extension/string.
To remove all language extensions you could run a query in the form:
UPDATE wp_posts
SET post_content = REPLACE(post_content, 'site.com/es/', 'site.com/')
WHERE post_content LIKE '%site.com/es/%'
On your database for each language extension. This will remove all references in post content. You'll also want to check your wp_options table, replacing finds in the option_value field.
Finally run a check on the wp_postmeta table - many items will be serialised values and so can't be changed with a simple find/replace like above. Instead you should run a find, then figure out how to change any found values via the Wordpress admin panel.
As always back up your database before playing around.

WordPress changes some option by itself

I'm editing a WP template in order to fit my requirements. I firstly installed WP on a temporary server and then moved (files + DB) to the new server (without reinstallation).
Now, I'm almost done, but sometimes it happen that the logo has changes, and some menu disappears. If I look at the database I discover that in 'wp_option' table, all value where url should be www.newserver.com reverted to the old www.oldserver.com
How does is this possible? How can I fix this? Is there something I should know before going on?
thanks
You can easily overcome this problem just go to
Dashboard-> settings-> general and replace wordpress address (url) and site address(url) with your domains url.
But prior to this setting you must change the value in wp_options table of option_name ->siteurl in database to your new siteurl or else it wont be possible for you to login into the dashboard of your site on server as unchanged siteurl will keep on redirecting you to localhost.
wordpress url shoud contain path to your wordpress folder whereas site address will be your domains name.
You came across this problem because you migrated your local's database onto the server and in the wp_options table the siteurl is still the same representing your local siteurl. This needs to be updated as mentioned above.
Wordpress stores the siteurl and address of wordpress folder in wp_options table to make functions like bloginfo ("siteurl")
to work properly and give you site address independent of changes.

wordpress new instance redirecting wp-admin to old url

For development purpose, I have duplicated the live instance files in a separate sub domain with different database. I modified the path the sub domain and .htaccess file including the database table setting changes. Everything works perfectly for the sub domain blog, However when I tried to access
http://dev.mysite.com/wp-admin
it is redirecting to
http://www.mysite.com/login?redirect_to=http%3A%2F%2Fdev.mysite.com%2Fwp-admin%2F&reauth=1
So the admin panel moving to root site admin.
I unable to find out which settings I missed out.
Any help/clue is much appreciated.
WordPress hardcodes your hostname several places in the database, including 'siteurl' and 'home' in the wp_options table. This can cause trouble if you forget to update some of them when you are moving your site.
I run these queries whenever I move or copy a WordPress install:
# update wp_posts set guid = replace(guid, 'old.com', 'new.com');
update wp_options set option_value = replace(option_value, 'old.com', 'new.com');
In a production setting, the guid of posts should not change. In a development setting, when the new site is on your local machine, it sometimes makes sense to uncomment that first line.
Take a look at the wp_options table in your database and make sure the siteurl value is set to http://dev.mysite.com/.
You can either use phpMyAdmin or if you have access to the database directly, you can view your option by:
select * from wp_options where option_name='siteurl';
And change it via:
update wp_options set option_value='http://dev.mysite.com/' where option_name='siteurl'

exporting database and wordpress theme not functioning properly

I'm to get migrate a website I populated for a friend from my server to his. Unfortunatly, the migration process isn't working the way it normally should.
Does anyone have an idea to what would cause this wordpress site to break and for all the navigation to direct to the original site?
Even my wp admin redirects to orginal page
Here's the site I hosted it on for demo: http://www.designobvio.us/avproduktor/
Here's the site I'm trying to migrate it too http://avprodukter.com/
I have no idea why avprodukters isnt working: steps I took.
Exported database from designobvio.us/avproduktor
Replaced all links with designobvio.us to avproduktor
imported database to http://www.avprodukter.com/
installed wp and now i'm here
I'm going to repeat this process again to see maybe I was just dumb
Wordpress has some special steps you have to take when migrating it to a different domain. Namely, you have to change the Blog URL from the administrative interface prior to moving the site.
There is a reference in the database to the old domain and that is what it is using to build the URL's. Without starting over, you can use a tool like phpMyAdmin, or even the MySQL console to change that setting in the database.
The two settings you would have to change in the database are in the wp_options table (assuming tables are prefixed with wp_). The two option_names are siteurl and home. Both of those should contain the old domain; you need to update them to reflect the new URL.
See Moving Wordpress from the Wordpress Codex for the full directions and steps to take in different scenarios.
You could start over and follow the steps from the link above, or you can just change those 2 values in the database and then you should be set.
Replaced all links with designobvio.us to avproduktor...
How did you do that? In phpmyadmin? If by a text editor with a database dump, you broke some serialized data. Use the queries below.
UPDATE wp_options SET option_value = replace(option_value, 'http://www.olddomain.com/', 'http://www.newdomain.com/') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://www.olddomain.com/','http://www.newdomain.com/');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.olddomain.com/', 'http://www.newdomain.com/');
UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://www.olddomain.com/', 'http://www.newdomain.com/');
And did you reset permalinks?
See Moving WordPress « WordPress Codex and How to Move WordPress Blog to New Domain or Location » My Digital Life

Categories