问题
I am trying to change my long url to something short I did it successfully but after sending get info URL is not chanining to what I want like I search for something and it show my url like this
/search.php?q=a&limit=150&siz=any
so I want to convert it automatically in url bar like this
/car/150/any
I am using this
RewriteEngine On
RewriteRule ^([^/]*)/([^/]*)/([^/]*)$ /search.php?q=$1&limit=$2&siz=$3 [R,NC]
but it is not converting link automaticly however it works when I write in url like
/car/150/any
same related question is asked by someone here so I need something like that for my link
Search url automatically in mod_rewrite version
Any help would be appreciated. Thanks
回答1:
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^search/([^_]+)/([0-9]+)/([^_]+).html$ search.php?act=$1&limit=$2&siz=$3 [L]
access url with
search/car/150/any
better put constant ^search as page identifier to avoiding conflict with other url rewrite,
([^_]+) can receive string input
([0-9]+) only can receive number input
来源:https://stackoverflow.com/questions/23863000/link-conversion-in-mod-rewrite-htaccess