Announcement

Collapse
No announcement yet.

TKLS using product name in htaccess file

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    TKLS using product name in htaccess file

    I am trying to implement tool kit TKLS function and would like to use the following structure. Any advise on how to do this?

    category
    http://www.domain.com/category-code.html

    product
    http://www.domain.com/product-code/product-name.html

    page
    http://www.domain.com/page.html

    This is what I have so far in my htaccess file

    Code:
    DirectoryIndex /mm5/merchant.mvc
    
    RewriteEngine On
    
    RewriteRule ^mm5/admin.mvc? - [QSA,L]
    
    RewriteCond %{REQUEST_FILENAME} !-s
    RewriteRule ^([^/]+)-p-([^/.]+).html$ /mm5/merchant.mvc?Screen=TKSL&Product_Code=$1&Category_Code=$2&%{QUERY_STRING} [L]
    
    RewriteCond %{REQUEST_FILENAME} !-s
    RewriteRule ^([^/.]+).html$ /mm5/merchant.mvc?Screen=TKSL&Code=$1&%{QUERY_STRING} [L]
    
    ### End - Inserted by Miva Merchant

    #2
    Re: TKLS using product name in htaccess file

    I don't believe that toolKit short links is set up to use product name in the URL at all, is it?

    I am pretty sure that it is set up to just work with either category-code.html or product-code.html

    I may be wrong, but as far as I know, TKSL won't handle using product code in the url.
    Mark Romero
    ~~~~~~~~

    Comment


      #3
      Re: TKLS using product name in htaccess file

      Hi Mark,

      Thanks for your comment. This is actually Brennan's recommendation since the new SEO module is not out till the Summer. So I believed it's doable. Just not sure how.
      Last edited by kitdang; 04-06-15, 08:41 AM.

      Comment


        #4
        Re: TKLS using product name in htaccess file

        Rick/Brennan,

        Can you help? or should I revert back to the old Sebenza seo module for now until the new one is release?

        Comment


          #5
          Re: TKLS using product name in htaccess file

          You can send the product name as the 2nd parameter like you have it. Essentially, it just appears in the url, but it is not used for anything. The 1st parameter is the product code and it is used for the actual lookup. I don't have an example handy.
          Bill Weiland - Emporium Plus http://www.emporiumplus.com/store.mvc
          Online Documentation http://www.emporiumplus.com/tk3/v3/doc.htm
          Question http://www.emporiumplus.com/mivamodu...vc?Screen=SPTS
          Facebook http://www.facebook.com/EmporiumPlus
          Twitter http://twitter.com/emporiumplus

          Comment


            #6
            Re: TKLS using product name in htaccess file

            Hi Bill,

            It's always great to see you on this forum. We miss you at MivaCon! I was told that you have some health issue. Whatever you are fighting, keep fighting as I am routing for you.

            As for your comment, I have no clue on where to even start without an example.

            Comment


              #7
              Re: TKLS using product name in htaccess file

              If it helps any, you can use a "custom" product field.....
              This allows you to change the content in the field if ever needed (although for indexing purposes, not recommended without doing a 301 redirect at least)....
              Anyhow here is what you would add to the .htaccess file:

              RewriteCond %{REQUEST_FILENAME} !-s
              RewriteRule ^p/([^/]+)/([^/]+)$ /mm5/merchant.mvc?Screen=PROD&Product_code=$1&PRODUCT_C USTOMFIELD=$2 [QSA,L]

              Then you will need to change the links to products site wide to something like this:

              <mvt:if expr="NOT ISNULL l.settings:product:customfield_values:customfields :PRODUCT_CUSTOMFIELD">
              <a href="/p/&mvt:product:code;/&mvta:product:customfield_values:customfields:PROD UCT_CUSTOMFIELD;.html">PRODUCT NAME</a>
              <mvt:else>
              <a href="/p/&mvt:product:code;.html">PRODUCT NAME</a>
              </mvt:if>

              This is just a rough idea.... Notice the added /p/ in the URL..... This is because the shortened SEO URL's are activated in Miva....
              As Bill mentioned earlier, the added content just appears in the URL but is not really used for anything.
              Last edited by MusicMan; 04-08-15, 03:50 PM.
              David Limon
              E-Commerce Signal

              [email protected]
              http://www.ecommercesignal.com
              http://www.davidlimon.com

              Comment


                #8
                Re: TKLS using product name in htaccess file

                Thanks David for chiming in. I am trying to keep it simple so creating a new custom field won't work for us. I will wait to see if one of Miva folks can provide some insights.

                Comment


                  #9
                  Re: TKLS using product name in htaccess file

                  Yeah, makes sense... This way would most likely create a lot of extra work for you.....
                  David Limon
                  E-Commerce Signal

                  [email protected]
                  http://www.ecommercesignal.com
                  http://www.davidlimon.com

                  Comment


                    #10
                    Re: TKLS using product name in htaccess file

                    There is going to be two steps you need to get this working to include the product name.

                    First, some clarification, Miva only needs the product code/category code in the URL. This is how it determines what product or category to show. Anything else, such as the product name would purely be used for SEO reasons.

                    First here is what you would need for the .htaccess file:

                    Code:
                    #Product Rewrite#
                    RewriteCond %{REQUEST_FILENAME} !-s
                    RewriteRule ^([^/.]+)/([^/.]+).html$ /mm5/merchant.mvc?Screen=PROD&Product_Code=$1 [L,NC,QSA]
                    
                    
                    #Category/Page Rewrite#
                    RewriteCond %{REQUEST_FILENAME} !-s
                    RewriteRule ^([^/.]+).html$ /mm5/merchant.mvc?Screen=TKSL&Code=$1 [L,NC,QSA]
                    The product rewrite is expecting the format /product_code/anything.html. In this case our "anything" is going to be our product name.

                    The second part to this is cleaning the product name so it can be used in the URL. A product name contains spaces and special characters which needs to be cleaned before you can use it in the URL. The code below is just an example, but you may have to adjust it based on any special characters found in your product names:

                    Code:
                    <mvt:assign name="g.clean_product_name" value="glosub(tolower(l.settings:product:name),' ', '' )" />
                    <mvt:assign name="g.clean_product_name" value="glosub(g.clean_product_name,'&', '' )" />
                    <mvt:assign name="g.clean_product_name" value="glosub(g.clean_product_name,'--', '-' )" />
                    <mvt:assign name="g.clean_product_name" value="glosub(g.clean_product_name,'"', '' )" />
                    <mvt:assign name="g.clean_product_name" value="glosub(g.clean_product_name,'!', '' )" />
                    Once you have the "clean" product name you can use in the URL you will need to go into any page template that links to a product (CTGY, Related Products, SRCH, PLST, etc) and output the correct URL:

                    /&mvt:product:code;/&mvt:global:clean_product_name;.html

                    The other thing to think about with this is 301 redirects. Because you will be using the product name in the URL, this value is not available in the htaccess file so you will need to do individual 301 redirects for every one of your product pages. If you have thousands of products, this won't be able to be done in the htaccess file. In that case you would need to do something like a rewrite map, or have Miva output the 301 redirect for you.
                    Brennan Heyde
                    VP Product
                    Miva, Inc.
                    [email protected]
                    https://www.miva.com

                    Comment


                      #11
                      Re: TKLS using product name in htaccess file

                      Thanks Brennan for the thorough walk through with code examples. I will try this over the weekend.

                      Comment


                        #12
                        Re: TKLS using product name in htaccess file

                        Where do you put this piece of code?

                        Code:
                        <mvt:assign name="g.clean_product_name" value="glosub(tolower(l.settings:product:name),' ', '' )" /><mvt:assign name="g.clean_product_name" value="glosub(g.clean_product_name,'&', '' )" />
                        <mvt:assign name="g.clean_product_name" value="glosub(g.clean_product_name,'--', '-' )" />
                        <mvt:assign name="g.clean_product_name" value="glosub(g.clean_product_name,'"', '' )" /> <mvt:assign name="g.clean_product_name" value="glosub(g.clean_product_name,'!', '' )" />
                        Nick Harkins
                        www.loveisarose.com
                        *Web Developer
                        *Miva
                        *Google Analytics, Search Console, Tag Manager, Merchant Center, Ads

                        Comment


                          #13
                          Re: TKLS using product name in htaccess file

                          sorry that didn't post right. what page should this code go on?

                          <mvt:assign name="g.clean_product_name" value="glosub(tolower(l.settings:product:name),' ', '' )" />
                          <mvt:assign name="g.clean_product_name" value="glosub(g.clean_product_name,'&', '' )" />
                          <mvt:assign name="g.clean_product_name" value="glosub(g.clean_product_name,'--', '-' )" />
                          <mvt:assign name="g.clean_product_name" value="glosub(g.clean_product_name,'"', '' )" />
                          <mvt:assign name="g.clean_product_name" value="glosub(g.clean_product_name,'!', '' )" />
                          Nick Harkins
                          www.loveisarose.com
                          *Web Developer
                          *Miva
                          *Google Analytics, Search Console, Tag Manager, Merchant Center, Ads

                          Comment


                            #14
                            Re: TKLS using product name in htaccess file

                            and will this approach work for miva 5?
                            Nick Harkins
                            www.loveisarose.com
                            *Web Developer
                            *Miva
                            *Google Analytics, Search Console, Tag Manager, Merchant Center, Ads

                            Comment

                            Working...
                            X