modx Evo 中基于 url 分段的重定向
假设您在 modx Evo
www.zipit.com.org/reference/toamovie/
中输入了这样的 url ,如果我有一个名为 toamovie
的页面,其父页面名为 < code>reference
但当有人输入该网址时,我希望它执行与
www.zipit.com.org/reference.html?myvar=toamovie
等效的操作,或者更重要的是, 我希望结果更像这样,其中 12
是文档
`www.zipit.com.org/reference.html?myid=12'
的 id我想知道是否这在 modx Evolution 中是完全可能的。我认为这应该可以通过一些 htaccess 魔法来实现,无论如何都是第一部分。我怎样才能得到该文件的值?这对于 htaccess 来说是非常难以访问的,因此需要有另一个部分可以插入数据库并获取该值。
let's say you have a url like this entered in modx Evo
www.zipit.com.org/reference/toamovie/
if I have a page called toamovie
whose parent is called reference
but when someone enters that url I want it to do the equivalent of this
www.zipit.com.org/reference.html?myvar=toamovie
additionally, or more importantly,
I'd like the result to be more like this, where 12
wouls be the id of a document
`www.zipit.com.org/reference.html?myid=12'
I'm wondering if this is at all possible with modx Evolution.I'm thinking that this should be possible to do with some htaccess magic, well the first part anyway. How could I get a value that the document? This would be quite inaccessible with htaccess, so there would need to be another part to it that could plug into the database and get that value.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通过在“OnPageNotFound”事件上调用的自定义插件应该可以实现这一点。
请记住,插件不包含在 php 标签中。
此外,该脚本会将任何不正确的 URL 传递给 zipit.org。可能需要一些错误处理。
It should be possible with a custom plugin called on the "OnPageNotFound" event.
remember that plugins aren't wrapped in php tags.
also that this script will pass any incorrect urls to zipit.org. Some error handling is probably desireable.