admin管理员组文章数量:1130349
I am a new to WordPress. Please help me with the following issue.
I created page A and set Parent to X, hence its permalink was displayed as "http://websitename/index.php/X/A/".
In page B, I reference to page A by the attaching the link "http://websitename/index.php/X/A/" there
I then changed Parent of page A from X to Y. The permalink of A thus was updated as: "http://websitename/index.php/Y/A/"
I visit page B again and click on link "http://websitename/index.php/X/A/", it still works and brings me to link "http://websitename/index.php/Y/A/"
I wonder how it could happen? I was expecting to see Page Not Found or something like that as link "http://websitename/index.php/X/A/" is no longer available.
There probably is something I don't know about how the link in WordPress works. Can somebody please help explain this to me? Thanks!
I am a new to WordPress. Please help me with the following issue.
I created page A and set Parent to X, hence its permalink was displayed as "http://websitename/index.php/X/A/".
In page B, I reference to page A by the attaching the link "http://websitename/index.php/X/A/" there
I then changed Parent of page A from X to Y. The permalink of A thus was updated as: "http://websitename/index.php/Y/A/"
I visit page B again and click on link "http://websitename/index.php/X/A/", it still works and brings me to link "http://websitename/index.php/Y/A/"
I wonder how it could happen? I was expecting to see Page Not Found or something like that as link "http://websitename/index.php/X/A/" is no longer available.
There probably is something I don't know about how the link in WordPress works. Can somebody please help explain this to me? Thanks!
Share Improve this question asked Nov 1, 2018 at 15:36 PinckcloudPinckcloud 31 bronze badge1 Answer
Reset to default 0That is called canonical redirect.
And it's done through redirect_canonical() which basically
Redirects incoming links to the proper URL based on the site url.
and
Will also attempt to find the correct link when a user enters a URL that does not exist based on exact WordPress query.
(Those excerpts were both taken from the function's reference.)
So in your case, although the post parent of A has changed from X to Y, the post A (or a post with that slug) still exists, and therefore, when you visit the old URL:
http://websitename/index.php/X/A/ (old URL - post parent is X)
with canonical redirect, you'd be redirected to the correct URL:
http://websitename/index.php/Y/A/ (new URL - post parent is Y)
and not being presented with a 404 (page not found) error page.
Try visiting http://websitename/index.php/A/ and you'd see the canonical redirect being applied.
And if you visit http://websitename/index.php/A123z/, assuming there are no post with A123z as the slug, then you'd see the 404 error page.
I am a new to WordPress. Please help me with the following issue.
I created page A and set Parent to X, hence its permalink was displayed as "http://websitename/index.php/X/A/".
In page B, I reference to page A by the attaching the link "http://websitename/index.php/X/A/" there
I then changed Parent of page A from X to Y. The permalink of A thus was updated as: "http://websitename/index.php/Y/A/"
I visit page B again and click on link "http://websitename/index.php/X/A/", it still works and brings me to link "http://websitename/index.php/Y/A/"
I wonder how it could happen? I was expecting to see Page Not Found or something like that as link "http://websitename/index.php/X/A/" is no longer available.
There probably is something I don't know about how the link in WordPress works. Can somebody please help explain this to me? Thanks!
I am a new to WordPress. Please help me with the following issue.
I created page A and set Parent to X, hence its permalink was displayed as "http://websitename/index.php/X/A/".
In page B, I reference to page A by the attaching the link "http://websitename/index.php/X/A/" there
I then changed Parent of page A from X to Y. The permalink of A thus was updated as: "http://websitename/index.php/Y/A/"
I visit page B again and click on link "http://websitename/index.php/X/A/", it still works and brings me to link "http://websitename/index.php/Y/A/"
I wonder how it could happen? I was expecting to see Page Not Found or something like that as link "http://websitename/index.php/X/A/" is no longer available.
There probably is something I don't know about how the link in WordPress works. Can somebody please help explain this to me? Thanks!
Share Improve this question asked Nov 1, 2018 at 15:36 PinckcloudPinckcloud 31 bronze badge1 Answer
Reset to default 0That is called canonical redirect.
And it's done through redirect_canonical() which basically
Redirects incoming links to the proper URL based on the site url.
and
Will also attempt to find the correct link when a user enters a URL that does not exist based on exact WordPress query.
(Those excerpts were both taken from the function's reference.)
So in your case, although the post parent of A has changed from X to Y, the post A (or a post with that slug) still exists, and therefore, when you visit the old URL:
http://websitename/index.php/X/A/ (old URL - post parent is X)
with canonical redirect, you'd be redirected to the correct URL:
http://websitename/index.php/Y/A/ (new URL - post parent is Y)
and not being presented with a 404 (page not found) error page.
Try visiting http://websitename/index.php/A/ and you'd see the canonical redirect being applied.
And if you visit http://websitename/index.php/A123z/, assuming there are no post with A123z as the slug, then you'd see the 404 error page.
本文标签: permalinksLink works although page was moved to another location
版权声明:本文标题:permalinks - Link works although page was moved to another location 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749213215a2333724.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论