1

Maybe I'm going about this in the wrong way, but I have some pages in our homegrown CMS that I want to convert to using pretty permalinks. Currently, their page URLs look this this:

http://ourdomain.com/articles/?permalink=blah-blah-blah

I want to convert these to:

http://ourdomain.com/articles/blah-blah-blah

I have a column in the db for permalinks, that when the article is created, automatically converts the title to a permalink.

How would I write the rewrite rule to accomplish this? Is this even the best way to accomplish this?

TWLATL
  • 2,859
  • 4
  • 25
  • 37

1 Answers1

2

If there's nothing in the query string you can omit QSA:

RewriteRule articles/(.+) articles/?permalink=$1 [QSA,L,B]
Artefacto
  • 96,375
  • 17
  • 202
  • 225
  • Hmm. That didn't work. But what did was using this .htaccess code: RewriteEngine On Options +FollowSymLinks RewriteBase /articles/view/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /articles/view/index.php [L] 1,L] ...and then getting the permalink through $_SERVER['REQUEST_URI'], trimming out the unneeded portions and filtering through mysql_real_escape_string, and using that as my query string. – TWLATL Jul 29 '10 at 12:10