views:

38

answers:

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?

+1  A: 

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

RewriteRule articles/(.+) articles/?permalink=$1 [QSA,L,B]
Artefacto
Hmm. That didn't work. But what did was using this .htaccess code:<IfModule mod_rewrite.c>RewriteEngine OnOptions +FollowSymLinksRewriteBase /articles/view/RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule . /articles/view/index.php [L]1,L]</IfModule>...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.
SerpicoLugNut
@SerpicoLugNut Well, if you give incomplete information, you won't get an accurate answer.
Artefacto