.htaccess URL rewriting challenge

前端 未结 2 1658
别跟我提以往
别跟我提以往 2021-01-18 01:32

I\'m having trouble with some URL rewriting.

All of the stuff below works fine, but I need to add a rule which removes querystrings from URLS.

site.c

相关标签:
2条回答
  • 2021-01-18 02:03

    This would remove query string from url

    RewriteRule ^(.*) /index.php/$1? [L] #remove query string
    

    Hope it helps

    0 讨论(0)
  • 2021-01-18 02:13

    I'm a little late for an answer, but since i was searching for a similar behaviour, i thought i should share it: you can also add a flag to a rewrite rule to remove the query string; the flag is [QSD], and it helps avoiding workarounds like the ? at the end ;-)

    Here you can find more about this flag. I feel like pointing out that "This flag is available in [Apache] version 2.4.0 and later"

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