我已经设置了.htaccess Url Rewrite 所有工作只是我的搜索功能停止如何使工作搜索功能
我的搜索网址是
http://domain.com/index.php?a=search&q=word
但是在提交搜索框之后,这个网址并不起作用
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>
感谢
答案 0 :(得分: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>