Php 在htaccess中使用get请求从我的表单重写URL
我只想将我的urlPhp 在htaccess中使用get请求从我的表单重写URL,php,.htaccess,mod-rewrite,Php,.htaccess,Mod Rewrite,我只想将我的urlexample.org/search.php?通过what=date&keywords=sample重新连接到example.org/search/date/sample 这是我的密码: 在mysearch.php中 <form name="frmSearch" action="search.php" method="GET"> <div class="row searchbox-container">
example.org/search.php?通过what=date&keywords=sample
重新连接到example.org/search/date/sample
这是我的密码:
在mysearch.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>
您可以使用以下规则:
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]
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]