In my web page search input I am using the get method, and the URL is something like this www.example.com/search?city=example&service=example2
, but I want a URL like this www.example.com/search/example/example2
; how can I convert?
Or maybe there is some other solution to get the data from html inputs and get a friendly URL?
3
Answers
I see others posting about routing, yes i can do like what, but i think first i need to solve problem with html submit action, because when i press the button its auto redirect to what standart format url
search?city=example&service=example2
, but like i say i need other format. So how i can solve this problem?My form action
In your routes.php file inside the config folder:
Now, inside your searchFunction:
I think its help you and also SEO.
Please write following uri rules in :
application/config/routes.php
its rewrite your url from
www.example.com/search?city=example&service=example2
towww.example.com/search-example-example2.html