So I'm using this HTML form for a simple search field
<form action = "/search/" method = "get">
<input type = "text" name = "search_term"/>
</form>
But then when it processes in the URL it's like this
http://mysite.com/search/?search_term=something
I know this is perfectly normal, but is there a way to get it to send like this?
http://mysite.com/search/something
I will then use .htaccess in the search
directory to rewrite the url.
You would have to use javascript to hook into the submit event of the form, or the click event of some button that submits the form, etc.
You would then redirect the page after constructing the url based on the inputs in the form.
Do you want just the URL to be pretty or you want the parameters to be hidden from the URL. You can change your
method='post'
and it'll pass all the parameters as part of the HTTP Header and completely hidden from your user. If you want to make the URL look nicer, you should look at mod_rewrite and .htaccess files on how to change a search query from?search_terms=something
to/something