Forum Moderators: rogerd & travelin cat

Message Too Old, No Replies

Building a new site in a subdirectory and redirecting it to root

         

specimen65

6:11 pm on Apr 29, 2016 (gmt 0)

10+ Year Member



Our outdated old Wordpress site is in the root directory and I have been building a new version of the site on the latest version of WP on a subdomain (ourdomain.com/new) and have a question about how to move it when it's done.

The old site at the root is running an old version of WP. I think the simplest thing to do would be to somehow just tell WP that the new site currently in the subdomain should be at / and get rid of the old site currently at root, but worry about losing search positioning if the URL's change.

Is there an easy way to do this?

travelin cat

6:21 pm on Apr 29, 2016 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



You would not be telling WP where the new site is, you would be re-directing the DNS to the subdomain and of course changing the references in Settings>General for "WordPress Address (URL)" and "Site Address (URL)".

As long as your url's are the same, you should not see any change in rankings. If your urls are different, make sure to redirect old pages to the new ones.

Caveat: I have encountered ISP's that do not allow a subdomain to be used in this manner. You should contact them first.

specimen65

6:43 pm on Apr 29, 2016 (gmt 0)

10+ Year Member



Is there an easier way to replace the old site at / with the new one?

Andy Langton

6:52 pm on Apr 29, 2016 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Do you mean a subdomain (new.example.com) or a subdirectory (example.com/new)?

specimen65

7:10 pm on Apr 29, 2016 (gmt 0)

10+ Year Member



Oh, sorry, a subdirectory. The old site I want to update is for eg at example.com and I want to put what has been built at example.com/new in its place with a new update to WP.

Andy Langton

7:17 pm on Apr 29, 2016 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Wordpress have a guide on how to move directories. See the link below:

[codex.wordpress.org...]

But easier is to keep it in the subdirectory, but make it appear to be in the root for users:

[codex.wordpress.org...]

That said, do your old and new URLs match? If they don't, then you're going to need to use some redirects.

specimen65

10:38 pm on Apr 29, 2016 (gmt 0)

10+ Year Member



What about if the new URL is example.com/new/services and the old one is example.com/services?

If I don't use redirects, would the new site in the subdirectory, which appears to be root to users, display the URL as example.com/services or example.com/new/services in the address bar?

Andy Langton

11:11 pm on Apr 29, 2016 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You would be rewriting requests for the subdirectory so that users are never aware of the subdirectory's existence. Your file system is (broadly) irrelevant to users - they request URLs. In the example given by Wordpress:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?YourDomain.com$
RewriteRule ^(/)?$ blog [L]


Requests for /url are rewritten to /blog/url, without redirects.

tangor

2:06 am on Apr 30, 2016 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I've picked a slow day and removed example.com from the server and replaced with the new example.com (with the appropriate redirects for old pages that either changed or were consolidated in the new setup). Do this if your desire is that / is the ACTUAL root, else designate which folder IS the ROOT as suggested above. Since this would also be an upgrade of Wordpress anticipate any problems and make the transition as seamless as possible.

Any of these changes still reflect that in the end what is reported is / so the "only" (and it is a lot!) change is the WP has changed and likely a boat load of urls as well.

specimen65

2:10 am on Apr 30, 2016 (gmt 0)

10+ Year Member



Would there be a conflict if say, there was an original URL on the main old site at root (example.com/services) and the new site at (example.com/new) was set to point the page example.com/new/services to example.com/services?

(there would be two different WP installs in two different directories pointing to the same URL)

tangor

5:47 am on Apr 30, 2016 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



? Are you going to replace old with new or run two versions of the same site with redirects and hope you can eat the cake and keep it, too?