Unable to get the 2nd Parameters of URL in Rewrite rule of .htaccess

后端 未结 1 821
抹茶落季
抹茶落季 2021-01-26 06:06

i am having another problem in getting 2nd Get Parameter of my Route i am unable to get the 2nd parameter here is the rule i wrote:

RewriteRule ^knowledgebase/t         


        
相关标签:
1条回答
  • 2021-01-26 06:21

    The query string is not included in the rewrite url pattern. From RewriteRule Directive

    What is matched?
    If you wish to match against the hostname, port, or query string, use a RewriteCond with the %{HTTP_HOST}, %{SERVER_PORT}, or %{QUERY_STRING} variables respectively.

    You must extract that part separately

    RewriteCond %{QUERY_STRING} page=([0-9]+)
    RewriteRule ^knowledgebase/topics/([0-9]+)-[A-Za-z0-9-]+ topic.php?id=$1&page=%1 [NC,L]
    
    0 讨论(0)
提交回复
热议问题