如何通过 PHP 获取/读取 Meta Canonical 中最干净的 url?
鉴于:像 /somepage?ln=en
这样的旧丑陋网址在 htaccess 中被重写为 /en/somepage
给定:使用规范元标记,上面有这个 php 脚本来填写整洁的 url:
如何使它们像规范?
<link rel="canonical" href="<?=$canonicalURL?>">
有什么方法可以解析没有任何字符串的当前 url,或者从 url 中删除多余的字符串并将其放入规范 url 中?
Given: old ugly urls like /somepage?ln=en
are rewritten in htaccess to /en/somepage
Given: used canonical meta tag, with this php script above it to fill in the tidy url:
How to make them like the canonical?
<link rel="canonical" href="<?=$canonicalURL?>">
What ways can one parse the current url without any strings, or, delete the extra strings from the url and put it into the canonical url?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
然后你可以这样做:
甚至:
Then you could just do:
Or even:
本质上,您只是想从 $extensions 中删除查询字符串,对吗?
Essentially, you just want to get rid of the query string from $extensions, correct?