(1)■html/products/.htaccess 挿入
.htaccess
RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^detail([0-9]+).html+ detail.php?product_id=$1 [L]
(2)パラメータに使用するかしないかを設定する。
.htaccessが利用できないサーバーでは動作しないため、パラメータ設定で元に戻すことができるようにしておく。
データベースへの挿入(mtb_constants)
INSERT INTO mtb_constants (id, name, rank, remarks) VALUES ('USE_STATIC_URL', 'true', 3005, '静的URLの有効・無効(true:有効,false:無効)'); INSERT INTO mtb_constants (id, name, rank, remarks) VALUES ('STATIC_URL', 'ROOT_URLPATH . "products/detail"', 3006, '商品詳細(静的URL)');
(3)下記に適用
①
■data/Smarty/templates/default/products/list.tpl(3カ所)
■data/Smarty/templates/default/frontparts/bloc/recommend.tpl(2カ所)
<!--{$smarty.const.P_DETAIL_URLPATH}--><!--{$arrProduct.product_id|u}--> ↓ <!--{if $smarty.const.USE_STATIC_URL == true}--><!--{$smarty.const.STATIC_URL}--><!--{$arrProduct.product_id|u}-->.html<!--{else}--><!--{$smarty.const.P_DETAIL_URLPATH}--><!--{$arrProduct.product_id|u}--><!--{/if}-->
②
■data/Smarty/templates/default/products/detail.tpl(「関連商品」の2カ所)
<!--{$smarty.const.P_DETAIL_URLPATH}--><!--{$arrItem.product_id|u}--> ↓ <!--{if $smarty.const.USE_STATIC_URL == true}--><!--{$smarty.const.STATIC_URL}--><!--{$arrItem.product_id|u}-->.html<!--{else}--><!--{$smarty.const.P_DETAIL_URLPATH}--><!--{$arrItem.product_id|u}--><!--{/if}-->
③
■data/Smarty/templates/default/mypage/history.tpl(1カ所)
<!--{$smarty.const.P_DETAIL_URLPATH}--><!--{$orderDetail.product_id|u}--> ↓ <!--{if $smarty.const.USE_STATIC_URL == true}--><!--{$smarty.const.STATIC_URL}--><!--{$orderDetail.product_id|u}-->.html<!--{else}--><!--{$smarty.const.P_DETAIL_URLPATH}--><!--{$orderDetail.product_id|u}--><!--{/if}-->
④
■data/Smarty/templates/default/mypage/favorite.tpl(2カ所)
<!--{$smarty.const.P_DETAIL_URLPATH}--><!--{$product_id|u}--> ↓ <!--{if $smarty.const.USE_STATIC_URL == true}--><!--{$smarty.const.STATIC_URL}--><!--{$product_id|u}-->.html<!--{else}--><!--{$smarty.const.P_DETAIL_URLPATH}--><!--{$product_id|u}--><!--{/if}-->
(4)商品詳細ページが表示されないときは、.htaccessが機能しない可能性が高い。
そのときは、静的URLは無効にします。
① パラメータ設定「USE_STATIC_URL」→false
② ■html/products/.htaccess ←削除
============================
2.13カスタマイズ(デフォルト)デモサイト
2.13カスタマイズ(デザインテンプレート適用)デモサイト
2.13レスポンシブWebデザイン(スタンダード)デモサイト
2.13レスポンシブWebデザイン(特集ページ作成版)デモサイト
▼詳細はこちらから
ダウンロードEC-CUBEカスタマイズ
============================