.htaccess fix for a pretty permalink in PHP?

匆匆过客 提交于 2019-12-03 23:01:43

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!