頁我有我的網站上搜索與友好的URL
<form class="clearfix" action="search.php" method="get">
<h1>Search the Site</h1>
<input class="field" type="text" name="q" id="query" value="" size="23" />
<input type="submit" value="Search" class="bt_login" />
</form>
現在它發佈到search.php中搜索表單,但我想它發佈到/搜索/查詢 - 在這裏。我的.htaccess文件看起來像這樣現在
ErrorDocument 404 /index.php?p=404
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^(products|blog|feed|search|checkout|checkout)$ $1.php [nc]
RewriteRule products/cat/(.*)$ products.php?type=cat&cat=$1 [nc]
RewriteRule products/(.*)$ products.php?type=single&product=$1 [nc]
RewriteRule blog/(.*) blog.php&post=$1 [nc]
RewriteRule feed/(.*) feed.phptype=$1 [nc]
RewriteRule search\.php?q=(.*)$ /search/$1 [R=301,L]
RewriteRule search/(.*)$ search.php?q=$1 [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?wghandcrafted.com/.*$ [NC]
RewriteRule \.(gif|jpg|jpeg|psd|js|swf|flv|png)$ /feed/ [R=302]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^images/.*\.jpg$ /images/default.jpg [L]
我該如何做到這一點?
什麼GET字符串你得到表單提交時? – Mark
表單發送獲取「q」進行查詢。它發佈get到search.php哪個起作用,但它需要被/ search/query – watzon
在301-重定向RewriteRule中不應該使用'?'-character轉義? – anroesti