php - Rewrite URL from my form using get request in htaccess -
i want rewite url example.org/search.php?by_what=date&keywords=sample
example.org/search/date/sample
.
here code : in search.php
<form name="frmsearch" action="search.php" method="get"> <div class="row searchbox-container"> <div class="twelve columns"> <div class="row collapse"> <div class="nine columns"> <input type="hidden" name="by_what" value="manning_agency"> <center> <input type="text" placeholder="type agency name here" name="keywords" id="keywords" size="40" class="small-txtbox-search-inner" value="<? echo $keywords; ?>" /> </center> </div> <div class="three columns"> <input type="submit" class="button expand postfix" name="" id="cmdsubmit" value="search" style="font-weight:normal !important; padding:7px !important; width:120px" /> </div> </div> </div> </div> </form>
and here .htaccess:
options +followsymlinks rewriteengine on rewritecond %{the_request} ^.*/index.html rewriterule ^search/(.*)$ search.php?$1 [qsa,l] rewritecond %{the_request} ^[a-za-z0-9]{3,9}\ /search\.php\?by_what=([^&]+)&keywords=([^&]+)(.*)\ http/ rewriterule ^search\.php$ example.org/search/%2/q/%1? [r=301]
you can use these rules:
options +followsymlinks -multiviews rewriteengine on rewritecond %{the_request} /search\.php\?by_what=([^&\s]+)&keywords=([^&\s]+)\s [nc] rewriterule ^ /search/%1/%2? [r=301,l,ne] rewriterule ^search/([^/]+)/([^/]+)/?$ search.php?by_what=$1&keywords=$2 [qsa,l,nc]
Comments
Post a Comment