1
假设我的网址为http://domain.com/category.php?id=2
可查看cars
类别中的所有文章。如何为查询字符串创建SEO网址
我的数据库结构category table
cat_id cat_name
--------------------
1 books
2 cars
和content table
con_id con_title con_cat
----------------------------------------
1 How to be a picker 1
2 How to repair your car 2
3 How to sell your car easily 2
如何改变我目前的网址是友好的搜索引擎优化?所以它应该是
http://domain.com/category/cars/
那么如何分辨这是/cars/
等于2
在content table
查询?
感谢特拉维斯的解释。从当前的问题URL'http:// stackoverflow.com/questions/9133135 /'将重定向到'http://stackoverflow.com/questions/9133135/how-do-i-create-a-seo-url-for-查询string'。 因此,从我当前的数据库结构,我可以改变它是这样的'http:// domain.com/category/2/cars /' – MRA 2012-02-03 18:07:22
那么在这种情况下,你写规则采取/类别/并发送它后面的数字到你的category.php?id = url 只要确保你没有任何SQL注入漏洞,尽管你应该这样做。但是我仍然坚持使用可能的最详细的用法,因为/ 2 /之后的所有内容都被忽略。 – TravisO 2012-02-03 18:09:00