My client had a subdomain hosted by kickapps for social networking. The company dropped him. We got the database of discussions from kickapps and inserted the discussions in wp_posts.
We soon discovered that some of the links refer to kickapps. Here is one sample:
Fortunately, I created the post_name from the discussion id, which in this case, is 'post-27764'.
When someone clicks on the link, you get the 404 page. Obviously.
There is enough information in the query string to extract the discussion id and compose the post_name.
The new URL becomes http://community.gottrouble.com/post-27764.
My current code uses this query to see if the post is published:
$post = 'post-' . $threadid; $page = 'http://community.gottrouble.com/' . $post; $r = $wpdb->get_results("SELECT post_status FROM $wpdb->posts WHERE post_name='" . $post . "'", ARRAY_A);
What is the best way to redirect to the new URL? Neither http_redirect nor header() work. (Yes, I removed all comments).
Thanks in advance.
In the 404 page