EC-CUBE:商品詳細ページを静的URLへ変更

detail.php?product_id=2

↓たとえば商品詳細ページのURLを下記のように変更します。

detail2.html

(1)html/products/.htaccess ←.htaccessを追加

.htaccess

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

(2)パラメータ変更(P_DETAIL_URLPATH )

ROOT_URLPATH . “products/detail.php?product_id=

ROOT_URLPATH . “products/detail

(3)以下の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}-->.html

■data/Smarty/templates/default/products/detail.tpl(「関連商品」の各2カ所)

 <!--{$arrRecommend[cnt].product_id|u}-->
 ↓
 <!--{$arrRecommend[cnt].product_id|u}-->.html

<!--{$arrRecommend[$cnt2].product_id|u}-->
 ↓
 <!--{$arrRecommend[$cnt2].product_id|u}-->.html

(4)スマートフォン用ファイルに「.html」を追記する。
■data/Smarty/templates/sphone/products/list.tpl(1カ所)

 <!--{$arrProduct.product_id|u}-->
 ↓
 <!--{$arrProduct.product_id|u}-->.html

■data/Smarty/templates/sphone/frontparts/bloc/recommend.tpl(各1カ所)

 <!--{$arrBestProducts[cnt].product_id|u}-->
 ↓
 <!--{$arrBestProducts[cnt].product_id|u}-->.html

<!--{$arrBestProducts[cnt2].product_id|u}-->
 ↓
 <!--{$arrBestProducts[cnt2].product_id|u}-->.html

■data/Smarty/templates/sphone/products/detail.tpl(「その他おすすめ商品」の1カ所)

 <!--{$arrProduct.product_id|u}-->
 ↓
 <!--{$arrProduct.product_id|u}-->.html

(5)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}-->.html

■data/Smarty/templates/default/mypage/favorite.tpl(2カ所)
■data/Smarty/templates/sphone/mypage/favorite.tpl(2カ所)

 <!--{$product_id|u}-->
 ↓
 <!--{$product_id|u}-->.html