duanseci1039 2009-01-17 13:29
浏览 9
已采纳

在RewriteRule到PHP脚本之后,从PHP中进行内部重定向

I have some mod_rewrite rewrites that correctly redirect the URLs to a script. From within the script, I want to go to a different file without causing another request/changing the URL.

I have experimented with Location and meta refreshes but they are not as smooth as desired.

Is there a way to change to the script or even return data to the rewrite rules so it can be further rewritten?

improfane.domain.com is sent to script which gets user id from database, I then redirect to the profile page with the user ID. I want it to be more smooth, without a redirect. It means that improfane.domain.com would stay in the URL, rather than going to domain.com/?profile=6

Thanks

  • 写回答

2条回答 默认 最新

  • douhan4093 2009-01-17 13:43
    关注

    You should use a front controller (also referred to as bootstrapping) to determine the route and include the correct script (rather than re-direct). A front controller is a single entry point to your application, and allows you to handle routing as you see fit.

    Most frameworks have a nice implementation of a front-controller, but for simple purposes you can roll your own.

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

报告相同问题?

悬赏问题

  • ¥15 html5+css有人可以帮吗?
  • ¥30 Unity接入微信SDK 无法开启摄像头
  • ¥20 有偿 写代码 要用特定的软件anaconda 里的jvpyter 用python3写
  • ¥20 cad图纸,chx-3六轴码垛机器人
  • ¥15 移动摄像头专网需要解vlan
  • ¥20 access多表提取相同字段数据并合并
  • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
  • ¥20 Java-Oj-桌布的计算
  • ¥15 powerbuilder中的datawindow数据整合到新的DataWindow
  • ¥20 有人知道这种图怎么画吗?