google検索でドメインのサブディレクトリを対象として検索をさせる方法

カスタム検索を使わずにドメインのサブディレクトリ内のページの検索結果のみを表示させるgoogle検索窓を設置する場合の簡易的な方法です。

<form action=”http://www.google.com/search” target=”_result”>
<input type=”hidden” name=”hl” value=”ja”>
<input type=hidden name=ie value=Shift_JIS>
<input type=”hidden” value=”検索対象のドメイン名” name=”as_sitesearch”>
<input type=”hidden” value=”/検索させたいサブディレクトリ名/” name=”q”>
<input type=”text” name=”q” size=”30″ maxlength=”256″ value=””>
<input type=”submit” name=”btnG” value=”検索”>
</form>

上記のようにコードを記述すればドメインのサブディレクトリの検索結果のみを表示させることが可能になります。

http://info-cache.com/turbolinux7/の検索窓サンプル

サンプルコード

<form action=”http://www.google.com/search” target=”_result”>
<input type=”hidden” name=”hl” value=”ja”>
<input type=hidden name=ie value=Shift_JIS>
<input type=”hidden” value=”http://info-cache.com” name=”as_sitesearch”>
<input type=”hidden” value=”/turbolinux7/” name=”q”>
<input type=”text” name=”q” size=”30″ maxlength=”256″ value=””>
<input type=”submit” name=”btnG” value=”検索”>
</form>

コメント

タイトルとURLをコピーしました