Apache Webサーバ .htaccess mod_rewrite
Apache標準モジュールのmod_rewriteを使ってSEO対策をしてみよう。 QUERY_STRINGを"/"スラッシュ区切りにして、静的ページを装うことにより、 Google検索に引っかかりやすくなるといわれています。 有名なところだと、2ちゃんねるはmod_rewriteを利用していますね。 例えば、 http://localhost/hoge/foo.cgi?param1=123¶m2=456 のようなURLのページがあるとします。 http://localhost/hoge/foo.cgi/param1/123/param2/456.html 上記のようなURLでアクセスさせたいときは.htaccessを下記のような記述します。 mod_rewriteの設定は太字部分です。 ---[.htaccessファイル]--- Options FollowSymLinks RewriteEngine on RewriteOptions MaxRedirects=1 RewriteBase /hoge/ RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^$ index.cgi [L] RewriteRule ^foo.cgi/param1/(.+)/param2/(.+).html$ foo.cgi?param1=$1¶m2=$2 [L] ErrorDocument 401 http://localhost/hoge/error.html ErrorDocument 403 http://localhost/hoge/error.html ErrorDocument 404 http://localhost/hoge/error.html ErrorDocument 500 http://localhost/hoge/error.html ----------------------- ちなみにmod_rewriteはロリポップレンタルサーバなら標準で設定されているようです。
http://goodjob.boy.jp/chirashinoura/id/27.html
作成日: 2005-10-15 01:16:59
最終更新日: 2005-10-15 01:21:00
▲このページの上へ管理人: ぶらざーほわいつ 連絡