php - Adding HTML search terms to results page URL -
currently have search box on site.com/search.php
. user enters in search term , taken site.com/index.php
displays results search terms. except, no matter user enters, results page url site.com/index.php
- instead, want read site.com/search=word1+word2
or each page has unique url based on search input.
i want work in reverse way, could, in theory, go straight site.com/search=query
, same thing if first went main search page, typed in, , hit return.
i'm new programming , started learning .htaccess
file understand i'll need in order this. @ total loss how want. know need sort of url re-writing not more that.
the easiest approach here change search form use method="get"
instead of method='post'
.
this create url like:
site.com/index.php?search=word1+word2...
simply change search script use $_get
or $_request
instead of $_post
, you'll set without other significant changes. let users directly run searches via url.
the downside of approach not create beautiful url (i.e. still shows "index.php")... however, can work around using .htaccess
rewrite url.
Comments
Post a Comment