Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/234.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 在htaccess中使用get请求从我的表单重写URL_Php_.htaccess_Mod Rewrite - Fatal编程技术网

Php 在htaccess中使用get请求从我的表单重写URL

Php 在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">

我只想将我的url
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]