這工作:用於搜索查詢的乾淨網址?
HTML
<a href="/search/querystring">query</a>
htaccess的
RewriteRule ^search/([-0-9a-z]+)$ /search.php?q=$1 [L]
通過搜索表單狀況:
<form method="get" action="/search">
<input type="search" name="q" value="querystring" />
<input type="submit" />
</form>
這可能與htaccess的或者我需要從search.php中內用PHP來重定向?在行動
例期望的結果:http://twitter.com/search/hello
編輯
我寧願不依賴於JavaScript來這樣做,所以搜索引擎和鄉親禁用JavaScript會看到這一點。
謝謝。查看我對JavaScript的編輯。 – DADU 2011-03-28 20:29:37
我不能想到另一種不涉及JavaScript的解決方案,但它必須在用戶關閉他/她的JS的情況下工作,而與其他(「醜陋的」)URL一起使用。 – 2011-03-28 20:34:31
毫米。它看起來並不像我想象的那樣直截了當。 – DADU 2011-03-28 20:43:19