dpo60833 2009-06-21 16:52
浏览 22
已采纳

mod_rewrite接管页面上的所有链接

I've used mod_rewrite to rewrite links on my site like so:

mysite.com/store/<store_id>/<store_name>/<page>
mysite.com/store.php?id=<store_id>&page=<page>

for example:

mysite.com/store/1313/johnny-walker-inc/13
mysite.com/store.php?id=1313&page=13

However, as a result, all my links that we're relationally placed now start at the end of the link, for example:

mysite.com/send_message.php

has become

mysite.com/store/1313/johnny-walker-inc/send_message.php

How can I fix this?

Here is my mod_rewrite code, in case I'm making a mistake with it:


RewriteRule ^store/([0-9]+)/[^/]+/([0-9]+)$ store.php?storeid=$1&page=$2 [L]

Thanks!

  • 写回答

3条回答 默认 最新

  • doushupu2521 2009-06-21 16:56
    关注

    You need to make your links relative to the root, like so:

    <a href="/send_message.php">link</a>
    

    Note the slash before send_message.php.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥20 有偿 写代码 要用特定的软件anaconda 里的jvpyter 用python3写
  • ¥20 cad图纸,chx-3六轴码垛机器人
  • ¥15 移动摄像头专网需要解vlan
  • ¥20 access多表提取相同字段数据并合并
  • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
  • ¥20 Java-Oj-桌布的计算
  • ¥15 powerbuilder中的datawindow数据整合到新的DataWindow
  • ¥20 有人知道这种图怎么画吗?
  • ¥15 pyqt6如何引用qrc文件加载里面的的资源
  • ¥15 安卓JNI项目使用lua上的问题