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

报告相同问题?