Apache Mod Rewrite for Pretty URLs isn't working

后端 未结 4 415
你的背包
你的背包 2021-01-15 02:13

I\'m trying to figure out how to do an apache mod_rewrite to remap $_GET.

What I\'m trying to accomplish:

Currentl

4条回答
  •  说谎
    说谎 (楼主)
    2021-01-15 02:52

    If you want the group ([0-9]+) to be alphabetic then just change it to ([a-z]+) and if you've wanted it to be alphanumeric, then change it to ([a-z0-9]+), and ([a-z0-9-_]+) if with a hyphen and an underscore. If you've wanted it to set their limits manually, you can do that with this format ([a-z0-9-_]{1,40}). Do you see, the plus sign is gone, for it limited the [chars] with 1 to anything, and the {1,40} limited the [chars] with 1 to 40, you can either change it.


    Do you know what the real problem is? Is my stress.. Imagine even I know that you want to remap /$var into /index.php?URL=pages/$var.php I'm still trying giving you a wrong information that will rewrite /index.php?URL=pages/$var.php into /$var. I just have realize that after my 4 hours sleep. Did you see what's happening when the time of your sleep isn't right? Maybe a rule I would gives to you when my brain's in functioning well, was:

    RewriteRule ^([a-z0-9-_]+)/?$ /index.php?URL=pages/$1.php
    

    Why did the viewers letting this to happened.. My previous codes are needed to be voted down.

提交回复
热议问题