I have created a custom module for searching.
I am using JQuery for post url like below
var url = "/ymm?year="+year+"&make="+make+"&model="+model;
jQuery(location).attr('href',url);
my custom url created like below :
http://domainname.com/ymm?year=123&make=test&model=test1
But I want to create url
like : /ymm/123-test-test1
I am using below code for rewrite url in root .htaccess
file but it's not working. it's goes to catelogsearch result page.
RewriteCond %{REQUEST_URI} ^/ymm [NC]
RewriteCond %{QUERY_STRING} ^year=(.*)&make=(.*)&model=(.*)
RewriteRule (.*) http://domainname.com/ymm/%1-%2-%3? [R=301,L]
Please advise me.
Thanks.
Best Answer
Try following way:
VendorName/ModuleName/etc/frontend/di.xml
VendorName/ModuleName/Controller/Router.php