WordPress is in my sub-directory – doh!
I installed a WordPress blog in the
[pre_pretty]/webdesign[/pre_pretty]
sub-directory of my web server during development but then decided that I want the website to be at the root.
This was because up to 10% of your link juice may be lost using a redirect from the root of a domain to a sub-directory. So instead of the website appearing at:
[pre_pretty]www.cheapcheapweb.co.uk/webdesign[/pre_pretty]
I wanted it to appear at:
[pre_pretty]www.cheapcheapweb.co.uk[/pre_pretty]
I thought I needed to physically move the WordPress files
I am experienced at using Joomla but am fairly new at using WordPress so I approached it in a slightly different way than a WordPress expert (probably because I am not an expert!)
- My first assumption was that, like Joomla, the WordPress files would need to physically be moved. They don’t!
- I then thought that any backlinks would need to be redirected via .httaccess. They don’t!
Google provided results about old versions of WordPress that didn’t help
After a Google search I found a few articles saying that I needed to change wp-config.php. I tracked the file down but the lines mentioned in these articles didn’t exist in my version of WordPress. This lead me to conclude that a change had been made in the way WordPress handles directories so most of the results were probably useless.
I did find a clue in another post over at semilogic which said:
[pre_pretty]Log into the old site, browse Settings / General, and change both of the site urls.[/pre_pretty]
You can make the change within WordPress without editing files
I checked out the WordPress Admin area mentioned and found there was an option to set a different WordPress root location – even if you keep WordPress in a sub-directory.
This sounded brilliant – exactly what I was after – and is something that Joomla would do well to copy. I often develop sites in a sub-directory and having the option to make this appear as if the files were at the root would be great.
I updated the site address to:
[pre_pretty]www.cheapcheapweb.co.uk[/pre_pretty]
I then followed the link to this article on giving WordPress it’s own directory and followed the instructions carefully – particularly steps 7 – 9. I then clicked save and it all worked!
However, this left me with backlinks going to the old URL’s.
Redirecting the backlinks
Using my Joomla experience I assumed I would need to add redirects into .htaccess – but this didn’t work.
To be honest this didn’t surprise me as the .htaccess file seemed to be built to do the URL redirect (above) . This left me with the scary option of trying to figure out how to re-write it to redirect a couple of incoming backlinks or try and find another solution.
A plugin will handle it!
This is when I found a very handy redirection plugin that does 404 and 301 redirects from within WordPress itself. Really neat and easy to implement! I like it because it could even be used to create easy to remember URL’s to make it easy for people to find specific posts.
It is a pretty basic plugin but it works perfectly. Problem solved!
Did you find this article helpful?
If you found this article helpful please take a moment to tweet, like, or share this article by using the buttons at the top or bottom of this page. I’d really appreciate it. 🙂
article says
Very nice article, totally what I needed.
Clipping Path Service says
Very impressive.awesome post.