旧ブログ(sb)→新ブログ(WordPress)へのリダイレクト設定

Home > BlogやSNS > 旧ブログ(sb)→新ブログ(WordPress)へのリダイレクト設定

旧ブログ(sb)→新ブログ(WordPress)へのリダイレクト設定

旧ブログ(sb)→新ブログ(WordPress)へのリダイレクト設定

目次

  1. 旧ブログのアクセスを引き継ぎつつ、個別記事ページを生成していないSereneBach(sb)からWordPressへ移行する方法(このエントリ)
  2. 新ブログのパーマリンク作成(投稿名ベース)
  3. 旧ブログ→新ブログへのパーマリンク対応作成
  4. SereneBachからエクスポートしたデータを編集
  5. WordPressにSereneBachからエクスポートしたデータをインポート
  6. 旧ブログ(sb)→新ブログ(WordPress)へのリダイレクト設定←今ここ
  7. 実際の移行レポートとその後

ここからが本番。旧ブログから新ブログへのリダイレクト設定を行います。SereneBachで個別記事htmlを作成していない場合はキツいです。

個別記事htmlを作成している場合

まずは簡単な方から。個別記事htmlを作成している場合、.htaccessのRedirect permanet機能のみでリダイレクトを行う事が可能です。検索エンジン相手にはステータスコード301を返し移動した事を知らせ、人間が普通にブラウザでアクセスしてきたら、移動先のURLに速攻で飛ばします。URL移転の際に、過去のアクセスを引き継ぐ一番良いと言われている方法です。

今回の場合なら、

Redirect permanent /sb/log/eid858.html http://prius.cc/d/20090312_heisei20nembunnokakuteishinkok.html
Redirect permanent /sb/log/eid857.html  http://prius.cc/d/20090311_union_bindgin_forceotsukattemi.html
Redirect permanent /sb/log/eid856.html  http://prius.cc/d/20090310_choukoii.html

Redirect permanent /sb/log/eid3.html http://prius.cc/d/20040422_tanjunnanamaedana_internet2.html Redirect permanent /sb/log/eid2.html http://prius.cc/d/20040415_bokobokoboko.html Redirect permanent /sb/log/eid1.html http://prius.cc/d/20040414_torakkubakkuyattemimashita.html Redirect permanent /sb/log/eid0.html http://prius.cc/d/20040412_akuachitannekku_fuaiten.html

と延々書いて行けばOKです

※参考URL

個別記事htmlを作成していない場合

しかし個別記事htmlを作成せず、sb.cgi + パラメータでアクセスしている場合この方法は使えません。なぜなら

Redirect permanent /sb/sb.cgi?eid=858 http://prius.cc/d/20090312_heisei20nembunnokakuteishinkok.html
Redirect permanent /sb/sb.cgi?eid=857  http://prius.cc/d/20090311_union_bindgin_forceotsukattemi.html
Redirect permanent /sb/sb.cgi?eid=856  http://prius.cc/d/20090310_choukoii.html

Redirect permanent /sb/sb.cgi?eid=3 http://prius.cc/d/20040422_tanjunnanamaedana_internet2.html Redirect permanent /sb/sb.cgi?eid=2 http://prius.cc/d/20040415_bokobokoboko.html Redirect permanent /sb/sb.cgi?eid=1 http://prius.cc/d/20040414_torakkubakkuyattemimashita.html Redirect permanent /sb/sb.cgi?eid=0 http://prius.cc/d/20040412_akuachitannekku_fuaiten.html

と.htaccessに記載した場合、「?」以降は移転先のURLのパラメータとして処理されます。つまり実質下記のようになってしまいます。

Redirect permanent /sb/sb.cgi http://prius.cc/d/20090312_heisei20nembunnokakuteishinkok.html?eid=858
Redirect permanent /sb/sb.cgi http://prius.cc/d/20090311_union_bindgin_forceotsukattemi.html?eid=857
Redirect permanent /sb/sb.cgi http://prius.cc/d/20090310_choukoii.html?eid=856

Redirect permanent /sb/sb.cgi http://prius.cc/d/20040422_tanjunnanamaedana_internet2.html?eid=3 Redirect permanent /sb/sb.cgi http://prius.cc/d/20040415_bokobokoboko.html?eid=2 Redirect permanent /sb/sb.cgi http://prius.cc/d/20040414_torakkubakkuyattemimashita.html?eid=1 Redirect permanent /sb/sb.cgi http://prius.cc/d/20040412_akuachitannekku_fuaiten.html?eid=0

対処方法

まずこういう.htaccessを作ります。

DirectoryIndex sb.cgi
RewriteEngine on
RewriteBase /sb
RewriteRule sb.cgi http://prius.cc/d/temp/ [R=301,L]
RewriteRule log\/index.rdf http://prius.cc/d/feed/ [R=301,L]
RewriteRule log\/atom.xml http://prius.cc/d/feed/ [R=301,L]

これで「http://prius.sakura.ne.jp/sb/sb.cgi?eid=858」へのアクセスは、「http://prius.cc/d/temp/?eid=858」へのアクセスになります。なお、最後の2行でRSSのリダイレクトを行っています。RSSはファイルへのアクセスなのでこれでリダイレクト完了です。

※Redirect parmanentでもできるかもしれませんが、僕がやった時は上手くいきませんでした。RewriteRuleBase、RewriteRuleについては、以下のURLを参考にしてください。

meta refreshを使う

では「http://prius.cc/d/temp/?eid=858」へのアクセスを「http://prius.cc/d/20090312_heisei20nembunnokakuteishinkok.html」に飛ばしてやれば良い。これにはmeta refreshを使います。

301リダイレクトが使えないときの転送方法 ≫ 海外SEO情報ブログ・メルマガ

具体的には「http://prius.cc/d/temp/?eid=858」にアクセスがあると以下のようなHTMLを出力するようなcgiを作ります。

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja">
<head></p>

<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>

<script type="text/javascript">
_uacct = "UA-72342-1";
urchinTracker();
</script>

<p><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta HTTP-EQUIV="Refresh" CONTENT="0; URL=http://prius.cc/d/20090312_heisei20nembunnokakuteishinkok.html">
<title>index.html</title>
</head>
<body>
</html>

…これはまぁ、実際のファイルをダウンロードして見て見て下さい。個別エントリ・プロフィール・カテゴリ・年月へのアクセスを、新URLに飛ばしています。プログラムを知らない人でも雰囲気はつかめると思います。

cgiファイルのダウンロードはこちら。

以上でリダイレクトの説明は終わりです。

次→実際の移行レポートとその後

関連する投稿

Web拍手&はてブ

下のボタンを押すと拍手を送ることができます。同時にメッセージも送れます。

はてブはこちら。このエントリーを含むはてなブックマークはてなブックマーク - 旧ブログ(sb)→新ブログ(WordPress)へのリダイレクト設定

Comments:0

Comment Form
Remember personal info

Trackbacks:0

Trackback URL for this entry
http://prius.cc/d/20090322_sb_wordpress_switch6html.html/trackback
Listed below are links to weblogs that reference
旧ブログ(sb)→新ブログ(WordPress)へのリダイレクト設定 from ぷりどうぐ

Home > BlogやSNS > 旧ブログ(sb)→新ブログ(WordPress)へのリダイレクト設定

Feeds
Meta

Return to page top