Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialNathalie C
2,594 PointsStuck changing site url in Wordpress
I'm so near the end of the How to Build a Wordpress Theme project, but failed miserably today at attempting to change the site url and ended up with the white screen of death or a whoops 404 error.
I've build the site direct on my live server, but have installed Wordpress into its own subdirectory and worked through the 'How to Build a WordPress Theme' project. A holding page for my site named index.php is in the root folder. I thought if I leave the home url as is with the subdirectory, and the site url changed to just the root address on the wp_config file it would work?
I removed the temporary index.php from the root and followed the steps of changing the site url in the wp_config file following steps at http://codex.wordpress.org/Changing_The_Site_URL
I failed miserably! Thankfully I had my backup which i've uploaded to get back to where I started this morning. Any help would be much appreciated.
10 Answers
Brian Clovis
5,899 PointsI did not yet do the lesson but might be an issue with the configuration. Make sure on whatever local server your using that mod_rewrite is on.
Nathalie C
2,594 PointsI've had a bit of success following instructions which seem easier to understand at http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory
I've changed the wp_config so that the WP_HOME is unchanged (i.e. mysite.com/subfolder) and the WP_SITEURL is changed to just the web address (i.e. mysite.com). I've copied the index and .htaccess file from the subdirectory into the root, and amended the index.php file. Next step is to log in to mysite.com/subfolder/wp-admin change the permalinks but I can't log in, I get a 404 error, arrh!
Brian Clovis
5,899 PointsCheck your apache config file to make sure mod_rewrite is not commented (hash-taged)out.
Nathalie C
2,594 PointsChecked the htaccess file. It had been considerably chopped in the backup file, so I've found an earlier version and copied and pasted the Wordpress chunk at the end which does reference the subdirectory. Still a 404 error though. Curiouser and curiouser. . .
Nathalie C
2,594 PointsI think it has to be the htaccess file causing the problem. I can see my site if I put in mysite.com/subdirectory but it's unstyled. If i try to log in to my site.com/subdirectory/wp-admin it redirects to mysite.com/wp-admin and gives a 404 error. Any ideas? Two conflicting instructions i have found mention the change to the index file but with a very subtle difference, a period. is it with, or without i.e.
/** Loads the WordPress Environment and Template / require( dirname( FILE ) . './mydirectory/wp-blog-header.php' ); or /* Loads the WordPress Environment and Template */ require( dirname( FILE ) . '/mydirectory/wp-blog-header.php' );
the difference being the '.' just before the forward slash /mydirectory
Nathalie C
2,594 PointsI've enabled debugging in the config file and get this error if I try to lo into wp-admin
Fatal error: Call to undefined function mytheme_categorized_blog() in /home/sites/mysite.com/public_html/subdirectory/wp-content/themes/mytheme/404.php on line 25
If anyone could put that into english for me i'd be ever so grateful : )
Matt Campbell
9,767 PointsHi Nathalie C,
You basically need to follow the steps for moving a site to a new domain as that is in essence what you're doing. On a server, you can run multiple sites and they're all just put into a directory of their own.
What you need to do is move the database to your new domain as well and update it. Basically, your database is looking for files at http://site.com/sub-directory but you've moved them all to http://site.com.
Nathalie C
2,594 PointsThanks for your help guys but I'm still stuck with a site that's loading but no css, or access to wp-admin. I've updated the database too, to no avail : ( time to call my hosting company.
Nathalie C
2,594 PointsReset back to how it was. Hosting company suggest move to root folder and update the database then. Bit disappointed haven't been able to get it to work.
Nathalie C
2,594 PointsI've solved it now. In case anyone else has the same problems, I restored from backup then started again, but first removing the WP_HOME and WP_SITEURL reference from the wp_config file. I cleared the browser cache and then logged in to wp-admin. Now I could change the site url through the admin panel. Then it all worked fine. Phew!