问题
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:
If there's nothing in the query string you can omit QSA
:
RewriteRule articles/(.+) articles/?permalink=$1 [QSA,L,B]
来源:https://stackoverflow.com/questions/3356173/htaccess-fix-for-a-pretty-permalink-in-php