Change Hosting Directory to use WordPress Sub-Directory

Web hosting discussion, programming, and shared and dedicated servers.
5 posts Page 1 of 1
by scos501 » Tue Mar 03, 2015 6:17 pm
I had Sonic install WordPress under a sub-directory of my website (mysite.com/wp) so I could configure and test a new WP site without affecting the live site. The WP site is now ready but when I change the Hosting Directory to the WP sub-directory (/home/WWW_pages/myaccount/mysite.com/wp), I lose the theme, images and CSS formatting. I DID change the SITE ADDRESS (URL) in the WP General Settings to http://mysite.com per the WP Codex and changed it back to see if that helped to no avail.

The WP site seems to function properly it just looks unformatted and imageless plus I can't get into the WP admin area as it still appears to be looking for mysite.com/wp/wp-login.php.

I also tried following the instructions here http://codex.wordpress.org/Giving_WordP ... _Directory - Section - Using a pre-existing subdirectory install. No Joy

And I tried just using a .htaccess rewrite. Again, no joy.

I have scoured the forum and seen references to changing info in the database which I apparently don't have access to as it was a Sonic install.

When I initially contacted support before embarking on this project, I was under the impression this should be fairly straight forward - am I missing something obvious?

Please advise! I am a designer not a developer - I know enough to be dangerous - so use little words please ;)
by thulsa_doom » Wed Mar 04, 2015 2:10 pm
Many of the links generated within Wordpress are made on the fly using the 'site url' variable from the settings in your dashboard, but any media files within posts are hard-set to wherever they were at when the post was written. It's possible that something similar is going on with your theme, particularly if it was customized by somebody that isn't a Wordpress ninja.

There are a few plugins like "Better Search Replace" that can be used to scrub references of your old URL and replace them with the new one. Always back up your data (both the database and the web files) before unleashing a search/replace tool on your content, of course. Better safe than sorry.
John Fitzgerald
Sonic Technical Support
by scos501 » Wed Mar 04, 2015 5:09 pm
Thanks for the response Thulsa and to clarify; it is not just the images but the CSS & theme also. I did make some theme changes but used a child theme. Also, I lose access to the admin area of WP.

Regarding your suggestions; Since I don't have access to the database apparently (per phone support) my only recourse is to use plug-ins to run a backup & search/replace which makes me quite nervous.

That being said, when you say
thulsa_doom wrote:scrub references of your old URL and replace them with the new one. Always back up your data (both the database and the web files) before unleashing a search/replace tool on your content, of course. Better safe than sorry.
What exactly am I search/replacing? Searching for mysite.com/wp and replacing with mysite.com? Again, sorry for the newbie question but as mentioned, support said all I had to do was change the hosting directory so I was NOT anticipating ANY of this! :evil:

Is there a way to do this using a redirect or .htaccess rewrites? The above is really out of my wheelhouse!

Any and all help will be greatly appreciated!
by thulsa_doom » Thu Mar 05, 2015 9:35 am
A mod_rewrite rule that takes your old base URL and replaces it with your new base URL would do the trick. Something like:

Code: Select all

RewriteEngine On 
RewriteRule /oldDirectory/(.*) /$1 [L]
Replace "oldDirectory" with the subdirectory you're swing your domain name over to (e.g. if you're making http://example.com/blog/ become the new http://example.com/ you'd use "blog" there).
John Fitzgerald
Sonic Technical Support
by cdkeen » Thu Mar 05, 2015 9:50 am
If you are still having problems moving the install to a different directory let me know and I will assist you. You can email [email protected], reference this post, and/or use the subject line attn:cdkeen if you prefer that to a post. Thanks!
cdkeen - Sonic.net System Operations
5 posts Page 1 of 1