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条)

报告相同问题?

悬赏问题

  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改