admin管理员组文章数量:1325954
A custom WordPress module takes certain int
variable directly from the PHP_URL_PATH
roughly like this:
private function myIdVariable() {
$myid = 0;
// Support both URL formats: /path/123 and /path/?myid=123
$lastpartofurl = (int) basename(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH));
$myid = (int) isset($_GET['myid']) ? $_GET['myid'] : $lastpartofurl;
return $myid;
}
Here, the /path/
is the SEO optimized path for the post/article where this module is used, and there's no articles in /path/subpath
.
Before the WordPress 5.5 update this worked, but now /path/123
gets automatically redirected to /path/
. It should result as the same page as /path/?myid=123
for prettier URLs giving better SEO.
Results from the Monkeyman Rewrite Analyzer shows this matches (.?.+?)?(:/([0-9]+))?/?$
.
As this code supports two URL formats, there's a workaround by adding a RedirectMatch
, e.g.
RedirectMatch ^/path/([0-9]+)$ "/?myid=$1"
However, for a real fix I would like to know:
- What might have added this redirection in WordPress 5.5?
- Is it configurable?
- Is this change in the URL behaviour intended in WordPress 5.5, or should I report a bug?
本文标签: url rewritingTaking a value from PHPURLPATH won39t work after WordPress 55 update
版权声明:本文标题:url rewriting - Taking a value from PHP_URL_PATH won't work after WordPress 5.5 update 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742190559a2430132.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论