Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have encountered some problems after I have redirected my site, which is in a sub directory in my server, to a new domain. I have kept the same server.

The origin URL of my wp site http://www.example.com/mywpblog, has been redirected to another new domain http://www.example.com.

Please help me solve the following :

  1. The original title of my WordPress page disappeared. My new domain name is the title which appeared in the title bar. I couldn't find it to edit while the origin is still there in the header.php.

    Q: How can I return my new title?

  2. Meta links don't work properly. For example, I try to open the "register" link (http://example.com/mywpblog/wp-login.php?action=register) and get a page with the following message: "the content cannot be displayed".

    Q: I assume there is some conflict with links so may be I should to edit these links on the sidebar.php?

  3. My post page's real link doesn't appear when I open I a post, just the http://newexample.com which keeps appearing in the address bar. I can't see the complete permalink.

share|improve this question
1  
Have you looked at this on Wordpress: codex.wordpress.org/… –  Carrie Lewis Jan 15 '13 at 22:54
    
I haven't posted about this issue here until I Looked at a lot of sites including codex .. –  user1973523 Jan 16 '13 at 0:15
add comment

3 Answers 3

There is a search and replace plugin I have used that works pretty good. http://wordpress.org/extend/plugins/search-and-replace/

In the future I would not hard code any links in if you can help it as well. Use dynamic linking like:

$url = site_url('/secrets/');
echo $url;

or:

img src="<?php echo get_stylesheet_directory_uri() ?>/images/aternus.png" alt="" title="" width="" height="" />

as an example.

share|improve this answer
add comment

When you change a WordPress URL, even if it is on the same server or up or down a directory, you must make several changes in the database to make sure things will work. All three of your issues are symptoms of not having the correct URLs in the database.

While you could start over and use one of the plugins mentioned to assist with the move, I don't think that is necessary. Instead, if you have access to your database simple run the following MySQL queries:

UPDATE wp_options SET option_value = replace(option_value, 'http://www.example.com/mywpblog', 'http://newexample.com') WHERE option_name = 'home' OR option_name = 'siteurl';

UPDATE wp_posts SET guid = replace(guid, 'http://www.example.com/mywpblog','http://newexample.com');

UPDATE wp_posts SET post_content = replace(post_content, 'http://www.example.com/mywpblog', 'http://newexample.com');

UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://www.example.com/mywpblog', 'http://newexample.com');

These four queries will update links and options and should eliminate most of your problems. You may have to change your permalinks back to default and then back to your preferred setting to regenerate them properly but otherwise the above should fix things.

share|improve this answer
    
This won't work. See the Codex. –  akTed Jan 16 '13 at 6:50
    
@AKTed Sorry but you are not totally correct about that. The Codex specifically uses "can" when talking about changing the URLs using this method and not "will" Additionally, the first query merely changes the first two keys in wp_options (which you have to do anyway) and the next three deal with posts, which the Codex indicates is safe to do ("When Your Domain Name or URLs Change" section, "Only perform a search and replace on the wp_posts table. "). –  JCL1178 Jan 16 '13 at 7:00
    
@AKTed What is not safe to do (according to the Codex) is a globalized search and replace on every table in the WP database due to potential serialization issues. There is a script for global S/R: interconnectit.com/products/…. Even so, I've moved a lot of WordPress sites and sometimes played fast and loose with the S/R and have yet to break anything. –  JCL1178 Jan 16 '13 at 7:04
    
What I meant by "won't work" specifically, is existing image/media links. Since these are serialized in the DB, a regular S/R won't change string lengths (which apparently the S/R tool you linked to will handle). [Deleted part about GUID...I'm probably wrong about that, I need to read more about it.] –  akTed Jan 16 '13 at 8:31
    
@AKTed I know and I still maintain that the queries are valid and won't kill serialization. If you look at your WP data (specifically wp_postsmeta for a meta key of _wp_attachment_metadata) you will not see a FQDN in the serialization so the 4th query won't hurt you. Instead we are looking for things like custom field values or other random artifacts that we see floating around postsmeta. But if you look in the wp_posts table where an image is inserted you will see a simple <img src="FQDN to old domain" /> tag. There is no serialization concern over changing that and the Codex agrees. –  JCL1178 Jan 16 '13 at 18:57
add comment

Unfortunately you can't just move a WordPress install to a new domain (or even a different directory) without doing a few things first. There are manual ways to do it (Google "move wordpress install"), but it's much easier using a plugin. I've had great success with Duplicator (don't let the name fool you, it works great for migrating and backup, too) and WordPress Move worked good for me as well.

If you can still access your WordPress install from the old domain, install and run one of those plugins and save yourself time and headache.

EDIT

For your circumstances, I'd recommend the WordPress Move plugin. Duplicator will only restore to a blank directory, and will overwrite the database, which may or may not be desirable for you.

share|improve this answer
    
but the server is still same. I have redirect my wp files to a new domain from the same server .do you I should move the install and backup ? –  user1973523 Jan 16 '13 at 2:34
    
There's more things that need to be done to move a WP install, whether it's to a different directory on the same server or to a completely different server. Stuff like search & replace stuff in the DB, etc. Plugin route is the easy way to go, but you need to run the plugin before the move. –  akTed Jan 16 '13 at 4:39
    
@user1973523 Note my edit. Also, my Answer (and previous comment) didn't clearly include, but also applies to: keeping your install on the same server in the same directory, but using a different domain name. –  akTed Jan 16 '13 at 4:45
    
I had arleady tried Domain switcher Plugin ... my page got messed not linked to css style ... there was fail call to css. I tried to login to change the settings ... I couldn't ... I get my site back through database wp_options url and home urls were replaced with the new domain by the plugin ... what is the right solution plugin or database?? –  user1973523 Jan 17 '13 at 0:54
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.