0

我已经在 .htaccess Url 中设置了重写所有工作只是我的搜索功能停止如何使工作搜索功能

我的搜索网址是这个

http://domain.com/index.php?a=search&q=word

但是在提交搜索框 url 之后,这个并不起作用

http://www.domain.com/?a=search&q=word

我怎样才能使搜索框工作?我的 htaccess 文件

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.domain.com
RewriteRule (.*) http://domain.com/$1 [R=301,L]
RewriteCond %{request_filename} -f
RewriteRule ^(.*) $1 [L]
RewriteRule ^([^/]*)$ /index.php?a=$1 [L]
RewriteRule ^([^/]*)/([^/]*)$ /index.php?a=$1&q=$2&page=$3 [L]
RewriteRule ^([^/]*)/([^/]*)/([^/]*)$ /index.php?a=$1&q=$2&page=$3 [L]

我的搜索表单

<form class="form-wrapper cf">
<form accept-charset="UTF-8" action="http://www.domain.com/index.php" method="get">
<input name="a" type="hidden" value="search" />
        <input type="text" id="search" name="q" placeholder="Search here..." required>
        <button type="submit">Search</button>
</form> 

谢谢

4

1 回答 1

0

我通过改变得到了解决方案

<form class="form-wrapper cf">
<form accept-charset="UTF-8" action="/index.php" method="get">
<input name="a" type="hidden" value="search" />
        <input type="text" id="search" name="q" placeholder="Search here..." required>
        <button type="submit">Search</button>
</form> 

改成

<div class="form-wrapper cf" >
<form accept-charset="UTF-8" action="/index.php" method="get"><div style="margin:0;padding:0;display:inline"><input name="a" type="hidden" value="search"/></div>
<input id="search" name="q" type="text"/>
<button type="submit">Search</button>
</form>
</div>
于 2012-07-06T18:05:42.557 回答