(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 ('STATIC_URL', 'true', 1413, '静的URL(true:使用する,false:使用しない)→【確認】P_DETAIL_URLPATH');
② パラメータ設定を開き、「この内容で登録する」ボタンをクリックする。
(3)パラメータ設定で以下を変更する(P_DETAIL_URLPATH )
ROOT_URLPATH . "products/detail.php?product_id=" ↓(変更) ROOT_URLPATH . "products/detail"
★静的URLを使用しないときは、パラメータ設定の「STATIC_URL」を「false」にすると同時に、値も元に戻す。
下記のtplファイルの記述は元に戻さなくても動作する。(戻してもよい)
(4)以下のPC用ファイルに「.html」を追記する。
■data/Smarty/templates/default/products/list.tpl(3カ所)
■data/Smarty/templates/default/frontparts/bloc/recommend.tpl(2カ所)
<!--{$arrProduct.product_id|u}--> ↓(変更) <!--{$arrProduct.product_id|u}--><!--{if $smarty.const.STATIC_URL == true}-->.html<!--{/if}-->
■data/Smarty/templates/default/products/detail.tpl(「関連商品」の2カ所)
<!--{$arrItem.product_id|u}--> ↓(変更) <!--{$arrItem.product_id|u}--><!--{if $smarty.const.STATIC_URL == true}-->.html<!--{/if}-->
(5)スマートフォン用ファイルに「.html」を追記する。
■data/Smarty/templates/sphone/products/list.tpl(1カ所)
<!--{$arrProduct.product_id|u}--> ↓(変更) <!--{$arrProduct.product_id|u}--><!--{if $smarty.const.STATIC_URL == true}-->.html<!--{/if}-->
■data/Smarty/templates/sphone/frontparts/bloc/recommend.tpl(1カ所)
<!--{$arrBestProducts[cnt].product_id|u}--> ↓(変更) <!--{$arrBestProducts[cnt].product_id|u}--><!--{if $smarty.const.STATIC_URL == true}-->.html<!--{/if}-->
■data/Smarty/templates/sphone/products/detail.tpl(「その他おすすめ商品」の1カ所)
<!--{$arrRecommend[cnt].product_id|u}--> ↓(変更) <!--{$arrRecommend[cnt].product_id|u}--><!--{if $smarty.const.STATIC_URL == true}-->.html<!--{/if}-->
(6)MYページのhistory.tpl,favorite.tplに適用
■data/Smarty/templates/default/mypage/history.tpl(1カ所)
■data/Smarty/templates/sphone/mypage/history.tpl(1カ所)
<!--{$orderDetail.product_id|u}--> ↓(変更) <!--{$orderDetail.product_id|u}--><!--{if $smarty.const.STATIC_URL == true}-->.html<!--{/if}-->
■data/Smarty/templates/default/mypage/favorite.tpl(2カ所)
■data/Smarty/templates/sphone/mypage/favorite.tpl(2カ所)
<!--{$product_id|u}--> ↓(変更) <!--{$product_id|u}--><!--{if $smarty.const.STATIC_URL == true}-->.html<!--{/if}-->
★スマホで「もっとみる」ボタンをクリックしたときに、商品詳細ページが開けないのを改善するためには、こちらをご覧ください。