通过index.php重写要路由的URL
将 http://www.example.com/page 等 URL 重写为 http://www.example.com/?pg=page 的最佳方法是什么?当我这样做时,它可以工作,但是页面中的所有引用(例如 JavaScript 和 CSS)都会被伪造。请帮忙。
What would be the best way to rewrite URLs like http://www.example.com/page to http://www.example.com/?pg=page? When I do it, it works but all the references within the page like JavaScript and CSS get fudged. Please help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当使用 mod 重写的 URL 时,
href 变得非常有用!例如,无论 URL 是什么,该源都会正确地提供来自
www.example.com/js/script.js
的 js。When using mod rewritten URLs,
<base>
hrefs become very useful! e.g.That source will properly serve the js from
www.example.com/js/script.js
not matter what the URL is.你可以试试这个:
You can try this: