0

The original non-wordpress site existed on http://example.com. While building the new site on wordpress, it was built on the wp subdomain: http://wp.example.com.

We just moved the original non-wordpress site to http://example.net and deleted the original http://example.com files. Now in trying to follow the 'Using a pre-existing subdirectory install' instructions from the Wordpress Codex we're still getting redirects to http://wp.example.com.

The codex page we followed is: http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory

Per steps 1-3, we started by going to the General WP-Admin Panel, changing the Site Address and URL from http://wp.example.com to http://example.com, then saved. Error 404 came and ignored per step 3.

Per step 4, within host's file manager, we used the copy function to copy the .htaccess and index.php files to the site root (public_html).

At step 5, we edited the index.php file adding /wp (the subdirectory) to make the primary line read:

require( dirname( __FILE__ ) . '/wp/wp-blog-header.php' );

Now when we attempt to access the http://example.com/wp-admin, we notice the site is attempting to direct us back to the old http://wp.example.com/wp-admin resulting in a 404 and the URL as follows:

http://example.com/wp-login.php?redirect_to=http%3A%2F%2Fwp.example.com%2Fwp-admin%2F&reauth=1

What did we miss?

3 Answers 3

0

You can't use http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory to move from a subdomain to a domain. WordPress can be moved up or down a directory level, but the same technique can't be used for subdomain - really a different domain - to another domain.

Follow Moving WordPress « WordPress Codex and WordPress Serialized PHP Search Replace Tool.

The main issue is you have to change URLs in the database - both in site options and everywhere else, such as theme options, widget data, etc. - and change them correctly by deserializing and reserializing php data. Don't change URLs in a text database dump; that will break things such as serialized data. And you can't simply change the two URLs in site settings; you need to change them throughout the database.

And, don't forget to change hardcoded URLs in style sheets and theme php files.

0

Can't be sure, but check the settings for your site in phpmyadmin, it'll list url/blog url edit this to what it should be.

0

I had this problem in the past, and it happens sometimes when I migrate a site and forget about those changes. In my experience always is about the data base. Go to PhpMyAdmin or anywhere yo can change database tables values. Open the website's data base and find the wp_options table, open that table. Then locate the column option_name and find the values: 'siteurl' and 'home'. Click Edit in both of them (one by one in the left part of the file) and change the current url for the url where the website is. Click the 'Continue' button at the bottom right, and after you do that with both values you should be able to login.

If you still have the site installed anywhere else, yo can use a plugin like Duplicator and make things so much easier.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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