exporting database and wordpress theme not functioning properly - php

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

Related

Migration problems with WordPress

We've got troubles with a migration of our website project.
We've migrated it to a local server (University) but we can't access to any pages of our website.
I think that's a problem of redirection with our pages. For the home page, we've got error 404 and when we're trying to connect to the other pages, not found, the requested url /index.php was not found on this server. On the "original server", it's working perfectly but even if I hard code the new url of our server in wp-config.php, it won't work.
Any idea how to resolve it ?
Let me explain to you the simple process when you transfer the wordpress website from an old domain to new domain. First of all upload all the files and in wp-config.php, change the db name, username, password and in some case db host too.
Now, go to the database and import the database of the old domain as it is.
After that you need to change the old domain to new domain. For that, you need to execute following four queries in the database.
UPDATE wp_options SET option_value = replace(option_value, 'http://olddomain.com', 'http://newdomain.com') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://olddomain.com','http://newdomain.com');
UPDATE wp_posts SET post_content = replace(post_content, 'http://olddomain.com', 'http://newdomain.com');
UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://olddomain.com', 'http://newdomain.com');
Now, login to the Dashboard, hover on settings and click on permalinks. Change the current permalinks settings. It is necessary to change the permalink.
If you have not followed this process, follow it and let me know if you still get the error.
You can use "All in One Migration" Plugin from which you can export entire Website data and then install Wordpress and the same plugin in another domain or in localhost and there you can import the data. Go to the following link :
https://wordpress.org/plugins/all-in-one-wp-migration/

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.

How to change the ABSPATH in Wordpress?

I've been trying to create a dummy duplicate of a custom-built WP/WooCommerce Site on the same server.
I've successfully moved the files to a subdomain and created a temp DB copy and updated the wp_config file, but I cannot for the life of me figure out how to set the ABSPATH value to reflect the subdomain instead of the main (non-test) domain. So now when you log in to the dummy WP site, it logs into the WP dashboard of the MAIN site.
**So my question is how do I change the ABSPATH value for the dummy site and will that also update the dummy URLs to point to the site URLs?
The main site URL is ldtuttle.com and the dummy site is dev.tuttle.com.
Thanks in advance for your time,
Lisa
There are two values in the 'wp_options' database table you need to change, 'siteurl' and 'home'.
This will tell Wordpress where to redirect a user for the login screen, and is normally filled out automatically when Wordpress initially creates the database on a domain.
You need to update more than Just the 'wp_options'
Also create a separate database for the- "dummy duplicate" - copy the original database there and then, update these database tables:
UPDATE wp_options SET option_value = REPLACE(option_value, 'ORIGINAL_URL', 'NEW_URL');
UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, 'ORIGINAL_URL', 'NEW_URL');
UPDATE wp_posts SET guid = REPLACE(guid, 'ORIGINAL_URL', 'NEW_URL');
UPDATE wp_posts SET post_content = REPLACE(post_content, 'ORIGINAL_URL', 'NEW_URL');
Some good articles:
http://www.wpbeginner.com/wp-tutorials/how-to-create-staging-environment-for-a-wordpress-site/
And:
https://codex.wordpress.org/Moving_WordPress
See Header: Moving Directories On Your Existing Server
I just want to add one thing related to #kreeverp's comment: you should be careful about replacing the GUID value, as the WordPress Codex explains. If you are moving FROM local development TO deployment, then it is safe to change them to the deployment URL. But if you are moving from one URL to another, both of which are deployed (e.g., changing from site.com to site.org) then you do NOT want to replace the GUID value.
(I would have left this as a comment to #kreeverp, but I can't do that yet!)

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'

Wordpress host IP changed

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

Categories