Rewrite query string in .htaccess

后端 未结 1 1297
陌清茗
陌清茗 2021-01-20 01:05

I\'m trying to do a very simple rewrite of a query string and I\'m having no luck at all. I need to go from

http:// example dot com/?ACT=jquery

<
相关标签:
1条回答
  • 2021-01-20 01:10

    If you just want it to pick up the php file without informing the browser:

    RewriteEngine On
    RewriteRule ^/\?ACT=jquery$ index.php/?ACT=jquery [PT,L]
    

    If you want the browser to change bookmarks etc. to create a cononical URL:

    RewriteEngine On
    RewriteRule ^/\?ACT=jquery$ index.php/?ACT=jquery [R=301,L]
    

    Assuming arbitrary arguments:

    RewriteEngine On
    RewriteRule ^/\?(.*)$ index.php/?$1 [PT,L]
    

    Or you might prefer a script alias:

    ScriptAliasMatch ^(.*)\?(.*)$ index.php
    
    0 讨论(0)
提交回复
热议问题