Skip to content

Miva 301 Redirect to Canonical#


Description#

301 redirect to a canonical URI

Snippet#

<mvt:comment>Build l.uri structure with required data</mvt:comment>

<mvt:assign name="l.uri:store_id" value="g.Store:id" />
<mvt:assign name="l.uri:screen" value="''" />
<mvt:assign name="l.uri:page_id" value="0" />
<mvt:assign name="l.uri:cat_id" value="0" />
<mvt:assign name="l.uri:product_id" value="l.settings:product:id" />

<mvt:comment>Load canonical URI for this product</mvt:comment>
<mvt:do file="g.Module_Feature_URI_DB" name="l.has_uri" value="URI_Load_Item_Canonical( l.uri, l.settings:product:uri )" />

<mvt:if expr="l.has_uri">
    <mvt:assign name="l.settings:product:uri:redirect_to" value="l.settings:product:uri:uri" />

    <mvt:if expr="'/mm5/merchant.mvc' CIN s.request_uri EQ 1">
        <!-- REDIRECT! -->
        <mvt:assign name="l.header" value="miva_output_header( 'Status', '301 Moved Permanently' )" />
        <mvt:assign name="l.header" value="miva_output_header( 'Location', l.settings:product:uri:redirect_to  )" />
    </mvt:if>
</mvt:if>

Functions Used#

  • URI_Load_Item_Canonical