DauntlessRob DauntlessRob - 1 month ago 6
MySQL Question

WordPress links all redirect to double URL

A fellow developer built a WordPress website on his local machine. He then migrated the whole installation onto a server. Naturally, all the links in sql were set to

localhost:8888
. I then ran a SQL update to fix the links so they pointed to the correct domain (which right now is an
ipaddress/~username
link). I've double checked my work, and it all looks correct.

UPDATE wp_options SET option_value = replace(option_value, 'http://olddomain.com', 'http://newdomain.com');
UPDATE wp_options SET option_value = replace(option_value, 'feed://www.olddomain.com', 'feed://newdomain.com');
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');


I used that coding, but with the appropriate domain information in there.

So now here’s what’s happening.

Whenever I go to the homepage, it works, but the images don't show up. then i click on a link, or travel to teh wp-admin, and it shows the url twice in the urlbar. so it goes to something like:

http://newdomain.com/~user/http://newdomain.com/~user/post-name-blah-blah-blah


the
.htaccess
file is all default, (if WordPress is in a subdirectory should it have a rewrite rule for that instead of just /?)

What could cause every link on the site to go to the same url twice, if none of them are listed like that in SQL?

UPDATE:

Alright, so I erased the whole database and reset that up, and then the site works fine. of course that means I lose all my content. I'm guessing i screwed up the sql query's somewhere down the line. But I can't find anywhere that has two urls, or would even cause this. More updates coming as I figure out my issue.

FINAL UPDATE:

I Solved it! Hopefully if anyone else comes here and has the same mistake, this will help. In the
wp_options
table the rows for
site_url
and
home
need to have http:// in front of them. Somehow on my, my sql query busted that portion. Of course I didn't notice because the address looked correct, because that normally works. but in this case it caused a never-ending loop with some links, and in others just doubled the address.

Answer

I Solved it! Hopefully if anyone else comes here and has the same mistake, this will help. In the wp_options table the rows for site_url and home need to have http:// in front of them. Somehow on my, my sql query busted that portion. Of course I didn't notice because the address looked correct, because that normally works. but in this case it caused a never-ending loop with some links, and in others just doubled the address.

Comments