mod_rewrite user id error

后端 未结 2 1789
故里飘歌
故里飘歌 2021-01-27 06:20

I\'m new to rewriting urls and wanted to know how i would rewrite

From this /profile/4

To this /profile.php?id=4

I have this rule so far

         


        
相关标签:
2条回答
  • 2021-01-27 06:55

    You are pretty much there. Try using this instead

    RewriteRule ^profile/(.*)$ profile.php?id=$1
    

    I found this good free resource online to help you test your rewrite rules before you post them to your live site. This may help for the future. It looks like your rule should work as you have it posted though. The problem must be somewhere else.

    0 讨论(0)
  • 2021-01-27 07:05

    Your rule is just fine so there's a redirection somewhere conflicting with it. I suppose that you don't have a real directory at /profile/4 so they main candidate left is mod_negotiation. Try this:

    Options -MultiViews
    
    0 讨论(0)
提交回复
热议问题