绝对链接和 mod_rewrite
我想使用 mod_rewrite 并将所有内容设置为使用“绝对链接”,以克服 URL 解析问题。现在我的链接看起来像(/file.php)而不是(./file.php),并且在本地主机上一切正常。
不幸的是,当我将项目放在实际服务器上时,链接不再有效,所以我想知道“/”指向哪里以及如何解决此问题。
(我此时不想使用 html 基本标签。)
- localhost: http://project.local
- 实际主机: http://project.com
这是我的 .htaccess 中的内容:
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^page/([0-9-]*) /home.php?page=$1 [QSA,L]
I want to use mod_rewrite and I set everything up to use "absolute links" in order to overcome URL resolving issue. Now my links look like (/file.php) instead of (./file.php) and everything works ok on localhost.
Unfortunately, when I put the project on my actual server, links are not valid anymore so I want to know where "/" is pointing to and how to resolve this issue.
(I do not want to use html base tag at this point.)
- localhost: http://project.local
- Actual host: http://project.com
And here is what I have in my .htaccess:
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^page/([0-9-]*) /home.php?page=$1 [QSA,L]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试使用重写库
try using rewritebase