2011-12-23 49 views
0

我有以下代碼:形式的搜索到的網址

<form action="search.php" method="get" name="searchprod" id="prodsearch"> 
<table border="0" cellpadding="0" cellspacing="0"> 
    <tbody><tr> 
     <td><input name="q" type="text" id="searchbox" value="Search" onfocus="this.value=''; this.style.color='#333333';" /></td> 
     <td><input type="submit" value="Search" class="searchButton" /></td> 
    </tr> 
</tbody></table> 
</form>  

當用戶搜索我怎樣才能使它所以它看起來像這樣「DVD-player.html」而不是」 search.php中Q = DVD +播放器「

我有.htaccess的地方,但不知道如何在窗體內做到這一點。

+1

你是說你想讓搜索結果頁面或產品頁面成爲'dvd-player.html'嗎?在SEO正切,我會鼓勵你不要索引你的搜索結果頁面,因爲它們將與你的產品頁面競爭,並可能被視爲*重複內容*。因此,您的搜索結果頁面的網址無關緊要。 – 2011-12-23 16:53:29

回答

1

您可以在表單的onsubmit事件中使用Javascript將表單動作更改爲searchbox-value.html

+0

我有點擔心廣告用.html的目標做GET操作。通常表示.html是要下載的文件,而不是用於響應GET的可執行文件 – mozillanerd 2011-12-24 18:51:26