Update: These re-write rules are wrong. See this post for correct rewrite rules.
My friend gave me a suggestion to make myself a “brand” out of this blog by calling it “Michi Knows”. Apparently, he stumbled into the name while thinking about the URL of my website. Funny story.
Anyway, I liked the name so I bought it. What’s another domain, right? Besides, it was bugging me that my blog had no title and had weird formatting.
Porting Word press over to this domain wasn’t all fun and games. Most importantly, I have tons of incoming links I wasn’t about to 404. My goal was to make sure every single link out there coming to my site would correct redirect. Here’s how I did it.
There is a file called .htaccess that web servers use to setup rules for processing requests. Or in other words, when someone visits a server, that file is checked and any rules listed in it dictate what to do next. My blog was previously located in a folder called blog/. I placed a .htaccess file there and put in the following content:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^/?(.*) http://www.michiknows.com/$1/ [R=301,L]
</IfModule>
Ignore that weird HTML tag thing. What’s important is the stuff in between.
- The first line is telling the server “hey, we’re gonna do some funky stuff with the URL.
- The second line tells the server “hey, everything is relative to where we are now” (blog/)
- The third line says “change anything you see into http://www.michiknows.com and then put whatever stuff came after “blog/” on the end of the new URL.
Thus, the above code would change:
https://examplestorefront.com/blog/blog/some-really-cool-article
Into:
http://www.michiknows.com/some-really-cool-article
Notice the distinction. The (.*) means “anything”, and the $1 refers to the “anything” found in between the parenthesis. The “R” means redirect, the “permanent” is more for stuff like search engines. The L stands for “Last” – as in: “this is the last rule, stop processing more”.
Let me know if anything in my new blog is broken. 🙂
Here’s some things I considered before moving that I hope you all consider if you ever move blogs:
- Moving means killing any page-rank I may have gained. My blog had a page-rank of 5 in only a few months. I figure I can do it again. 🙂
- Moving means losing a lot visibility in search results. Now that the content is on an unknown domain, results can omit me a lot. I don’t even know what Technorati is going to do!
- Any tracking you have of users is destroyed due to the changing of cookie domains. Yep, now everybody is anonymous again.
- Incoming link tracking in Word Press completely breaks. It currently says “No results found.”
Anyway, no big deal. I look forward to finally having a blog-only domain. 🙂 Thanks Jackson for the name idea.
ohHHh…so that’s why it was broken. I couldn’t read any of your posts before 🙁