ページ 2 of 2 Joomla!移行時のリダイレクト さ て、このサイトもJoomla!(CMS)に移行したわけですが、「 Redirect permanent 」では不適切だと気が付きました。 Joomla!はphpのクエリ(?item=~という表記)で動いていますが、これではSEO対策にならないので、 Rerightエンジンを使って、ディレクトリパスに変更しているわけです。 http://www.fulldigit.net/ index2.php?option=com_content&task=view&id=41&Itemid=28 ↓ http://www.fulldigit.net/content/view/41/28/ つまり、上記の場合、「 /content/view/41/28/ 」といったディレクトリは見かけ上だけで、実際には存在しないわけです。 さて、千ページ説明した「 Redirect permanent 」は、転送先URLにも元のファイルへのパスを補完してURLを作成してアクセスしてくれる便利な機能ですが、Joomla!では問題があります。 例えば http://www.fulldigit.net/debian/rerite.html ↓ http://www.fulldigit.net/content/view/41/28/ としたいわけですが、 Redirect permanent /debian/ /content/view/41/28/ と記述してしまうと、 http://www.fulldigit.net/content/view/41/28/rerite.html といったURLになってアクセスされてしまいます。 ディレクトリパスは存在しないため、Rerightエンジンで変更されたパスにファイルが補完されてしまうと、思った通りのページに移動しないケースが発生してしまいます。 そうならないためには、「 Redirect permanent 」ではなく、「 RedirectMatch permanent 」を使います。 「 RedirectMatch permanent 」は、正規表現を使って、ファイル名補完なしにリダイレクトを行なうことができます。 なお、このサイトでは次のように設定しました。 RedirectMatch permanent ^/index\.html$ http://www.fulldigit.net/index.php RedirectMatch permanent (.*)/LINUX/(.*)\.html$ http://www.fulldigit.net/content/category/2/3/9/ RedirectMatch permanent (.*)/site/(.*)\.html$ http://www.fulldigit.net/content/category/1/1/5/ RedirectMatch permanent (.*)/se/(.*)\.html$ http://www.fulldigit.net/content/category/3/9/27/ RedirectMatch permanent (.*)/debian/(.*)\.html$ http://www.fulldigit.net/content/category/2/6/10/ 上記の設定では、あるディレクトリ(例えば、[/LINUX/]の配下にある、拡張子[.html]を持っているファイルが、すべて、右辺に設定したURLにリダイレクトする設定になります。 もちろん、この設定ではファイル名などが補完されることはありません。 CMSへの移行の際にお試し下さい。
|