[EC-CUBE2.4.2]静的URL設定

1月 16th, 2010 by marumi Leave a reply »

EC-CUBEの動的URLを静的URLに変更する。(SEO対策)
↑ここがとてもわかりやすかったです(とっても感謝)。
1)「.htaccess」を作成。
内容:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^detail([0-9]+).html+ detail.php?product_id=$1 [L]
RewriteRule ^list([0-9]+).html+ list.php?category_id=$1 [L]

2)「.htaccess」を「html/products」にアップロード。
静的URLでページ(例:「/products/list1.html」)が開けることを確認。

3)管理画面から、「システム設定」-「パラメータ設定」に入り、下記を変更。

DETAIL_P_HTML : URL_DIR . “products/detail”
MOBILE_DETAIL_P_HTML : MOBILE_URL_DIR . “products/detail”

静的URLでページ(例:「/products/detail1.html」)が開けることを確認。

4)下記のリンクを静的URLに変更。
・カテゴリブロック(category.tpl)
・商品一覧ページ(list.php)
・おすすめ商品ブロック(best5.tpl)
・商品詳細ページの関連カテゴリ(detail.tpl)
・Myページの購入履歴(history.tpl) ※これだけは管理画面では編集不可。

「category_id」
「product_id」
を含むリンクを探しだし、下記のように編集。(例↓)

<a href="<!--{$smarty.const.URL_DIR}-->products/list.php?category_id=<!--{$arrTree[cnt].category_id}-->">
編集↓
<a href="<!--{$smarty.const.URL_DIR}-->products/list<!--{$arrTree[cnt].category_id}-->.html">

<a href="<!--{$smarty.const.DETAIL_P_HTML}--><!--{$arrRecommend[cnt].product_id}-->">
編集↓
<a href="<!--{$smarty.const.DETAIL_P_HTML}--><!--{$arrRecommend[cnt].product_id}-->.html">

Advertisement

コメントを残す