We are just sampling the success we have had with not only ds106, but many other classes at University of Mary Washington, in getting students going with their own domains and web sites under Domains of Ones Own. One niggling issue is on the wordpress installer, it is set by default to install the blog in an ugly subdirectory named wordpress
so rather than having my web presence sitting at my domain, like http://coolestdogevah.me/ I end up with it living at http://coolestdogevah.me/wordpress
Butt Ugly Urls.
Even worse is that if someone goes to the root URL, they get a default server screen. Martha and I offered this week some extra credit to students that could figure out a way to redirect any traffic from say http://coolestdogevah.me/ to http://coolestdogevah.me//wordpress to fix that issue. There are several ways one could do this, some htaccess redirect, or a redirect in a PHP or HTML file, the latter which Crystal managed to do successfully.
That’s still not the desirable solution to me, as I really would prefer to kick the blog up top the top of my domain. What follows is the CogDog Way, maybe not the most elegant, but one I recently did to move Ashley’s blog from http://hockey-in-heels.com/wordpress to http://hockey-in-heels.com (she has one of the coolest domain names picked!). Both those links work, FWIW.
The strategy is:
- copy all the essential wordpress files up ne directort level from …/httpdocs/wordpress to …/httpdocs/
- Tweak two database table entries (yeah diving into the database may be scary, but its worth being able to say you have done it)
- Set up a re-direct on tye main index.php in te original install directory
The meta lesson here is that all fo your content of your blog sits in the database, and this means you can not only move the blog up and down your domain directory chain, but you can move it across town to another domain. The files on the server are the core wordpress files, plus the themes, uploads, and plugins, everything that resides in the wp-content directory.
Here is what I did to nudge Ashley’s blog to the desired place.
Nurse, pass me a scalpel.
The first step is to go to the File Manager, and navigate to the /wordpress subdirectory. Click the check box above all of the items, to select them all. Then click the Copy/Move button.
We want to leave the old ones in place as some of our blog may reference images left in the old wp-content folder. We could try and adjust them later, but its not a big deal to leave them in place so URLs work.
They key next is when we get the confirmation, is to edit the destination directory to be httpdpcs (the root directory of your web site, it will by default have the source directory httpdpcs/wordpress, so knock off the trailing part:
This of course puts a copy of all that stuff up one directory level, where we need it.
Now we have to go to the database (there are other ways to do it, but I think everyone with a domain should look inside their database). Go to The control panel, and under Web Sites and Domains, click “more” and then “Databases”. With one wordpress blog, there is only one database, but if you evert install more blogs, you will want to make sure you select the right one:
On the next screen will be a top option for Webadmin they gateway to phpMyAdmin, a tool for being Master of your Own Database. Now it gets geeky fun. On the left side are a list of database tables that store everything to manage your blog. One table stores all the user data. Another stores each blog post. The one you want to click is called wp_options, it keeps all the settings for your blog.
The first screen has a bunch of stuff, but the first one you want to edit is the first one called siteurl- you will see that it currently will have something like http://hockey-in-heels.com/wordpress/ and that is the first one we have to change.
Click Edit on that row, and then change the URL to read where we want the site, http://hockey-in-heels.com/
Save that one.
Now advance to the next screen of rows in the wp_options table, we are looking for a similar ne to edit that is called home.
Do the same kind of edit, turn http://hockey-in-heels.com/wordpress/ into http://hockey-in-heels.com/
This is actually all you need, and your site should now work perfectly at its shorter URL. The last thing we want to do ius some cleanup just in case someone visits the old URL.
Go back to your file manager, navigate to the httpdocs/wordpress directory, and click the pencil icon on the line for index.php – this by the way, is the single entry point for every web request to your site. We are going to subvert it to do something different.
Right below the top section wou see in the image below, we are going to add some PHP code- here it is so you can copy it – do not worry, this is simple to do. Breathe. Relax.
//Just redirect for now added by cogdog to move site
All this does is to say whenever this file is requested, rather than doing the regular wordpress mumbo jumbo that follows, you should instead go up one directory level to the index.php file for my new location.
At this point we have done everything we need to. If you want to have a clean house, you should delete everything in the httpdocs/wordpress directory EXCEPT .htaccess, index.php, and the wp-content directory.
Okay, are you still with me? There are a few steps here, and you are tinkering with the working parts of your site, but that is what you should learn to be ok with trying to do. It is not the most direct way, but I have done this already for 2 students. if you want me to walk you through it, just contact me.