WordPress URL结构逻辑,两个不同的URL如何指向相同的内容?

时间:2013-10-15 03:45:06

标签: wordpress url-rewriting

我注意到在重写WordPress网站中的网址后,我可以使用两个网址访问相同的内容:

http://example.com/category/article-name-here/primary_key

以及

http://example.com/category/article-name-here

这两个网址都指向完全相同的内容。它背后的确切逻辑是什么,文章名称本身是独一无二的吗?

我正在创建一个具有相同网址结构的启动网站。但我不能拥有相同的unique-article-name

2 个答案:

答案 0 :(得分:1)

查看此文章:

http://codex.wordpress.org/Using_Permalinks

它说

In the Settings → Permalinks panel (Options → Permalinks before WordPress 2.5), you can choose one of the "common" structures or enter your own in the "Custom structure" field using the structure tags.

答案 1 :(得分:0)

Wordpress使用称为路由器的东西,它也是许多框架的一部分,特别是 MVC框架,用于确定要显示的内容在URL上。例如,它可能在数据库中查找某些内容(例如,已重命名的旧页面),然后根据该内容显示内容,或者它可能只查找服务器上的文件,然后显示404页面,如果它没有找到它。

基本上,请查看路由,因为它与 PHP框架相关,以了解整个逻辑的工作原理。