mod_rewrite URL conversion Mar26 '05

I spent the better half of the day trying to understand Apache’s mod_rewrite directive, to help convert my permalinks over to a better format.

My current permalinks look like this:

http://www.matthom.com/archive/2005/03/26/01/

The 01 at the end changes to 02, 03, etc – for however many entries there are for that day.

This is a partially poor URI.

It’s descriptive, with the dates, but the number at the end means absolutely nothing to the naked eye (and search engines, etc).

I’d like to have my permalinks appear as such:

http://www.matthom.com/archive/2005/03/26/mod-rewrite-url-conversion

Just by looking at it, you can ascertain extremely useful information. The year, month, day, and condensed title of entry.

I know how to make my URI’s appear like that. The problem is... having the old permalinks map to the new permalinks.

One solution is to use this line in my .htaccess file:

Redirect /archive/2005/03/26/01/ http://www.matthom.com/archive/03/26/mod-rewrite-url-conversion

Of course, the code above would all be on one line.

This is sufficient, but only for that specific URI!

What about the other 480 blog entries that I have? I’d have to write a rule for each one.

This is absurd.

I need some way of having my Redirect rule change according to whatever the entry request is. In other words, a dynamic redirect.

Still looking for the answer...

Categories: Apache

Add Feedback (view all)

Leave feedback

Feedback

Input format: The editor controls below will assist with Markdown syntax.

Status

Sub-status

Your info

I had the same problem when I changed over to my new permalink model. My old one looked something like this: http://blog.dalegroup.net ... Read more.

matthom is published and produced by Matt Thommes - an independent publishing enthusiast, mobile blogger, content creator, informative writer, web developer from Chicago. Never one to conform, Matt intends to promote the effect the web has on our lives, in an effort to intensify, instruct, and clarify all that is happening around us.

Contact Matt

Similar Entries

Stats

9 unique visits since December 2008

Syndicate

Advertisements