dputlf5431 2012-07-28 12:42
浏览 51
已采纳

使用localhost中的.htaccess文件重写URL

So I have managed to rewrite urls using the .htaccess file but the redirection messes up the url. For example I try to rewrite this:

localhost/mysite/public_html/class/5/

into this:

localhost/mysite/public_html/index.php?v=class&id=5

and I use the following lines in the .htaccess file:

RewriteRule ^public_html/([A-Za-z]+)/([0-9]+)/?$ ./public_html/index.php?v=$1&id=$2 [L,R]

but the browser redirects me here (I am using wamp on Windows 7):

localhost/C:/wamp/www/mysite/public_html/index.php?v=class&id=5

Which is wrong and gets me a 403 error. What should I do?

  • 写回答

4条回答 默认 最新

  • duanjun7801 2012-07-30 11:51
    关注

    It's unbelievable. The error was a result of Firefox's caching. I used Chrome and it was ok. So I cleared Firefox's cache and everything worked fine.

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

报告相同问题?

悬赏问题

  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记