0

I've got a WordPress site I built in a subfolder of an existing, active hosting account with another WordPress site in the main folder, per my client's instructions. Something like http://www.siteurl.com/NewSite/.

The plan was to take a domain that was currently active on another hosting account and point it to that folder, so that instead of being active at http://www.siteurl.com/NewSite/, the site would be accessible at http://www.newsite.com. I had all my ducks in a row, pointed the DNS settings, and thought I was good to go.

After the DNS had propagated properly, the site was working at http://www.newsite.com, but all the links were accessible at http://www.siteurl.com/NewSite/differentpage instead of http://www.newsite.com/differentpage. I'd get an error if I tried to access http://www.newsite.com/differentpage directly. No big deal, right? I thought all I needed to do was set up a search & replace in Sublime Text 2 that replaced all instances of siteurl.com/NewSite with newsite.com, so that's what I did. A tech I spoke to on the phone with my host confirmed this.

So I dropped all the old tables, and imported the new database with all instances of siteurl.com/NewSite replaced with newsite.com.

To my surprise and irritation, though, it didn't work. The site was mostly the same, but somehow an enormous amount of settings had been dropped from the theme, including all the custom CSS I had written. I quickly restored the database to the previous form, with instances of siteurl.com/NewSite instead of newsite.com, and things went back to normal.

My question is, what the heck am I missing? Is there a part in the database that needs to have an absolute pathway on the FTP that I shouldn't edit? If so, how should I go about picking out those specific space or spaces? Why have I never encountered this issue before when pointing the DNS to subfolders?

To phrase it another way, what is it about simply changing the valid domain featured in several pathways would cause the site to not recognize numerous specific database entries, but leave others intact. They seem to only be a problem with fields associated directly with the theme options themselves. I'm using the Total theme, by WPExplorer, if that helps at all.

Thank you. Grateful for any help anyone can offer.

0

In general you should always develop under the final URL the site is going to be located in, if you are going to put content or anything else which contains URLs ad part of the development.

Not sure what gave you the idea that you can just search replace things in the DB and it will just work. Data which is serialized via the PHP serialize function will most likely break when trying to search and replace on it, and while it is easy to know where such data is located on vanilla wordpress install, you are not likely to know such things about plugins and themes.

There are some plugins you can try to make the search and replace which at least will be able to handle the core structures, maybe they will be smart enough for other settings as well. This mainly depends on what kind of crazy things the plugin and theme you use do.

And to reiterate, code should be developed separate from the content in a way which is hosting agnostic. Content and settings should be set only on the production server, or staging server which is almost identical to the production.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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