GET variable after mod_rewrite

后端 未结 2 969
难免孤独
难免孤独 2021-01-14 22:00

I have a set of product pages that obey the following htaccess rule:

RewriteCond %{REQUEST_FILENAME} !-s
RewriteCond %{REQUEST_URI} ^/([0-9]+)\\-(.+)\\.html
         


        
相关标签:
2条回答
  • 2021-01-14 22:38

    Add the QSA flag to pass along existing query string params

    RewriteRule . /product/index.php?prod=%1-%2 [QSA,L]
    

    Also edited match as . and ^.*$ are equivalent in this case

    0 讨论(0)
  • 2021-01-14 22:44

    Your looking for QSA, Query String Append

    RewriteCond %{REQUEST_FILENAME} !-s
    RewriteCond %{REQUEST_URI} ^/([0-9]+)\-(.+)\.html
    RewriteRule ^(.*)$ /product/index.php?prod=%1-%2 [L,QSA]
    
    0 讨论(0)
提交回复
热议问题