How to: Change your WordPress blog URL
Written by Malin on August 14, 2007 – 11:35 am -
Before changing anything in the files, do a backup just in case!
This is a little tutorial on how to change your WordPress blog URL without moving any files!
Lets say that you have installed WordPress in a subfolder called “blog” and the URL is: http://www.mywpblog.com/blog/
That long URL isn’t very nice to look at or to type in. You can change all this so that http://www.mywpblog.com/ can be the address to your blog instead. There is no need to move all these files from the subfolder to the root!
Here is the simple 9 step way to do it:
- Create a index.php file by just open a text editor, like NotePad, create a new file, copy and paste the code below. Where it says “blog” you have to change it so it matches the name of your own subfolder! Then choose “Save file as” and in the filename column, type in index.php and save.
<?php /* Short and sweet */ define('WP_USE_THEMES', true); require('./blog/wp-blog-header.php'); ?> - Upload the index.php file to your root.
- Also remember to move the .htaccess file (that’s in your subfolder) to root as well. You might want to download it and open it in a text editor and check the coding in it. It should look like this, otherwise it probably won’t work:
# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress - Log in to your WP administration panel and click the “Options” tab.
- In the “General Options“, look up where it says “WordPress address (URL)” and “Blog address (URL)“.
- In the “WordPress address (URL)” area, the URL to your WP installation already should be filled in, it should say something like http://www.mywpblog.com/blog/ so no need to change that one!
- Lets focus on the “Blog address (URL)” area. It will already be filled with ie http://www.mywpblog.com/blog/ but here is where you change it. And since you want the URL to be without the subfolder, you just delete /blog/
- Now it should say http://www.mywpblog.com in the field, then press “Update Options“
- The next step is to go to the “Options” tab again, click on “Permalinks” and the click on the “Update permalinks structure” button. Then you’re done!
Then save the file without editing the filename, and upload the file to your root.
Now the address to your blog will be http://www.mywpblog.com instead of http://www.mywpblog.com/blog/. And it looks way better!
For more advanced (or a better explanation for those who have a hard time with mine) instructions you can check out the WordPress codex about Moving_WordPress_Within_Your_Site.
Thoughts Aside
JN0-521 as well as 642-565 are both excellent choices for first time credit course. Later you can also glow for 646-562 or 642-873 or else continue your work. The best thing about Walden University apart from the studies was the environment and availability of courses like 646-171 at all times.
Posted in How to |
- How to: Change the Read More link in WordPress
- WordPress Bits
- Wordpress 2.5 is out!
- Wordpress tip: Wordpress Theme Generator
- Tip of the day: Wordpress Theme Hacks
10 Responses
to “How to: Change your WordPress blog URL”
2 Trackback(s)
- Aug 15, 2007: Becky’s Guide To Blogging » Blog Archive » Blog Moved
- Aug 17, 2007: Cactuus is moving up! | Infektia.net
Sorry, comments for this entry are closed at this time.
By JHS on Aug 14, 2007 | Reply
OK, but you have to go to step one for some of us.
That would be the answer to this question: How do I create the file referenced in step 1?
Seriously.
By Malin on Aug 15, 2007 | Reply
[quote comment=”35″]OK, but you have to go to step one for some of us.
That would be the answer to this question: How do I create the file referenced in step 1?
Seriously.[/quote]
Thanks for letting me know! Sometimes it’s hard to think like a newbie and I just write on not explaining it properly. I will explain that step more in depth, so check back later!
By Casey Stamper on Aug 15, 2007 | Reply
That works for the home page but breaks all of my links - must be relative paths instead of absolute. I don’t feel like changing all of the links.
By Malin on Aug 15, 2007 | Reply
[quote comment=”38″]That works for the home page but breaks all of my links - must be relative paths instead of absolute. I don’t feel like changing all of the links.[/quote]
Go to your admin panel again and then the tab “Options” and then click on “Permalinks”. And then click the “Update Permalink Structure” button and it will solve itself.
Let me know if you have any other problems and I’ll try to help you out!
By Jenny on Aug 15, 2007 | Reply
I just put what’s in the index file into the index file that’s in the root folder. That works for me. But this is an interesting way to do it too. I’ma try it. :)
By Casey Stamper on Aug 15, 2007 | Reply
Yep. That’s all I did. When I changed the URL on the Options page, all my permalinks broke - even after I updated them. So, I just left the “redirect” index.php in the root folder and everything works great. Plus, the old link works as well so I don’t have to rush off and change the link on everything I’ve publicized, etc.
By Becky on Aug 15, 2007 | Reply
I’m about to do this now… fingers crossed !
By Jenny on Sep 13, 2007 | Reply
That’s interesting. I’m gonna have to try that on one of my sites to see how it works up close. :)