Rewrite Rule in htaccess convert query string into slashes php

后端 未结 3 816
一整个雨季
一整个雨季 2020-12-20 05:54

OK I\'ve tried multiple solutions but still can\'t achieve it. so what I need to do is

mydomain.com/search?q=product&l=london

t

3条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-20 06:51

    You can achieve the URL mydomain.com/search/product/london by using the following rule in your .htaccess.

    RewriteEngine On
    RewriteRule ^search/([^/]*)/([^/]*)$ /search?q=$1&l=$2 [L]
    

    Just make sure you clear your cache before testing this.

提交回复
热议问题