Categories
Wordpress

How To Redirect Permalink Using .htaccess

Yesterday i was confused to find a way to change my Manchester United Blog permalinks. When i started the blog about a year ago, i didn’t realize how important it was to have a pretty permalink for SEO purposes.

However, yesterday i decided to change the permalink into more search engine friendly but also don’t want to lose any of those backlinks.

The objective was to change this structure:

/%year%/%monthnum%/%day%/%postname%/

into this:

/%postname%/

My effort started by doing Google search and leads to this post by SearchEngineJournal but the new permalinks didn’t work, as backlinks always lead to 404 pages. I’m not sure why. I think it work for most people since i didn’t see anyone complaining at the post comments except me :D, sorry, i’m not that techie i suppose.

Anyhow i tried to do the search deeper to find a way to solve this problem and leads to Joost De Valk’s Permalink Redirect plugin. I installed the plugin and it still didn’t work. Then this moment came. I finally had the courage to email him asking why the plugin didn’t work. Well, it will be a long back and forth email to answer my question since the reason must be somewhere at the process. However he replied to my email asked me to try using .htaccess and give me these codes:

RedirectMatch 301 /dddd/dd/dd/(.*) /$1

So i created a .htaccess, using it in my blog and it suddenly work! Just worked.

Anyway, if you don’t know how to create the .htaccess file (and don’t have any in your blog folder), here’s how.

  1. Copy above code into a text editor.
  2. Name the file as ‘.htaccess’ (no quotes) then save.
  3. Now open your File Explorer or FTP Explorer. You’ll find .htaccess.txt. Click on the file and push F2 or click twice (not double click) to rename the file. Delete the .txt file so the file should look like this: .htaccess (no file extension).
  4. Now simply FTP the .htaccess file to your blog root.
  5. That would be it.
  6. Please note that this work with the link structure started as /year-month-day-post-title and change it to /post-title. Other way i’m not sure this technique will work.

Joost de Valk is a very cool guy and i will never forget this. I know he must be very busy but he still take time answering emails and answer my questions. If you never heard of him (i doubt you never heard of him if you’ve been around the blogosphere for a while…) here’s his very cool blog. You can find many useful SEO/Blogging/Wordpress related posts, especially his WordPress SEO article. A must read to every WordPress website owners.

Awesome.

5 replies on “How To Redirect Permalink Using .htaccess”

A couple of things to note:
Your .htaccess files must be in ASCII encoding and it also is a great way to canonicalize your URL to heighten the search engine visibility of your Web site.

Hi Jeffrey, thanks for your note. Hope the tips can be useful for people.

FYI, i checked out to your site which has a very cool design. However, i can’t access the other pages like your blog etc.

Again thanks for stopping by.

Leave a Reply

Your email address will not be published. Required fields are marked *