修复的.htaccess在PHP中的pretty的永久链接? [英] .htaccess fix for a pretty permalink in PHP?

查看:140
本文介绍了修复的.htaccess在PHP中的pretty的永久链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

也许我要对此的方式是错误的,但我已经在我们自主开发的CMS一些网页,我想转换为使用pretty的固定链接。目前,他们的网页的URL看起来这样的:

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-等等

我希望将这些转换为:

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?

推荐答案

如果没有什么在查询字符串中可以省略 QSA

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

RewriteRule articles/(.+) articles/?permalink=$1 [QSA,L,B]

这篇关于修复的.htaccess在PHP中的pretty的永久链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆