Announcement

Collapse
No announcement yet.

Affiliate link structure

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

    #16
    Re: Affiliate link structure

    This thread has two different subjects, but the OP (title) was never responded to. Can someone guide me to instructions for creating unique landing pages for the Miva affiliate program?

    Comment


      #17
      Re: Affiliate link structure

      I probably should have noticed this (much much) sooner, but it seems like the additions made to my .htaccess file to allow affiliate links to work is actually causing other redirects in the .htaccess file to not work. The affiliate links work fine, but redirecting old, unused urls to current pages appends data to the url and causes Miva to display a "Not Found" page.

      For example, there used to be a page that was example.com/purchase.html - this should redirect to example.com/shop.html using this redirect in my .htaccess:

      Code:
      Redirect 301 /category/singles.html http://example.com/category/species.html
      It used to work, but now goes to this url:
      example.com/category/species.html?Screen=CTGY&Category_code=singles

      This is what is in the Miva Merchant section of my htaccess.
      Code:
      ### Begin - Inserted by Miva Merchant
      
      RewriteEngine On
      
      RewriteRule ^mm5/admin.mvc? - [L]
      
      RewriteCond %{REQUEST_FILENAME} !-s
      RewriteRule ^product/([^/.]+).html$ /mm5/merchant.mvc?Screen=PROD&Product_code=$1&%{QUERY_STRING} [L]
      
      RewriteCond %{REQUEST_FILENAME} !-s
      RewriteRule ^category/([^/.]+).html$ /mm5/merchant.mvc?Screen=CTGY&Category_code=$1&%{QUERY_STRING} [L]
      
      RewriteCond %{REQUEST_FILENAME} !-s
      RewriteRule ^([^/]+)/([^/.]+).html$ /mm5/merchant.mvc?Screen=PROD&Category_code=$1&Product_code=$2&%{QUERY_STRING} [L]
      
      RewriteCond %{REQUEST_FILENAME} !-s
      RewriteRule ^([^/.]+).html$ /mm5/merchant.mvc?Screen=$1&%{QUERY_STRING} [L]
      
      ### End - Inserted by Miva Merchant

      Comment


        #18
        Re: Affiliate link structure

        Sorry for the delayed reply. On your first example, you may have posted the wrong code? You mentioned:

        example.com/purchase.html should redirect to example.com/shop.html

        but the code you posted would be for a redirect of /category/singles.html to /category/species.html.

        In any case, I'm going to guess that the issue may be one of two things, or both; the order in which things appear in the .htaccess file and/or a lack of a question mark to terminate the redirected query string.

        For redirects that need to operate against URL's that do not actually exist and depend on Rewrites to work, they need to appear above the rewrites, not below. The reason for that is if the request coming in is for /category/singles.html, your rule "RewriteRule ^category/([^/.]+).html$...." is going to pick it up first and do something before the Redirect statement is reached.

        Second, when using redirects and rewrites, there are times when rewrites are still processed even after a redirect occurs, so when the internal request is handled, it is redirected, but then the short link rewrite still appends the original query string it would have used onto the resulting URL, giving you:

        example.com/category/species.html?Screen=CTGY&Category_code=singles

        I would adjust the order in the htaccess first, and if the issue still occurs, adjust your Redirect (which is now above the rewrites), to the following:

        Redirect 301 /category/singles.html http://example.com/category/species.html?

        The only difference is you'll see there is now a ? on the end. That tells the browser/server to not append any original query string onto the new URL.
        David Hubbard
        CIO
        Miva
        [email protected]
        http://www.miva.com

        Comment


          #19
          Re: Affiliate link structure

          Thanks for the reply. I finally had a moment to try out your advice. Changing the order doesn't seem to make a difference, but adding the '?' to the end seems to work for now.
          Is there any chance adding this '?' in .htaccess will prevent the affiliates' links from being recognized? Is there an easy way to check that the affiliates' codes are in the cookie?

          Comment


            #20
            Re: Affiliate link structure

            Adding the ? strips any and all arguments off the URL, including affiliate tracking codes. What format are your tracking codes? It may be possible to preserve just that piece with a more complex rewrite.
            David Hubbard
            CIO
            Miva
            [email protected]
            http://www.miva.com

            Comment


              #21
              Re: Affiliate link structure

              The format is supposed to be just ?Affiliate=accountname

              So a url would be: example.com/category/species.html?Affiliate=user

              Comment


                #22
                Re: Affiliate link structure

                I do not know if this will work but it's worth a try. We're going to have to use rewrite rules instead of redirects:

                RewriteCond %{REQUEST_URI} /category/singles.html
                RewriteRule ^(.*)$ http://example.com/category/species.html? [R=301,QSA,L]

                The ? will strip anything else, including what I hope to be internal rewrites, and the QSA will append the original query string back to the request, so if someone came in on /category/singles.html?affiliate=blah then it should redirect to species.html?affiliate=blah

                This rewrite must come above your short link rewrites; i.e. the ones that look something like

                RewriteRule /category/(.*).html /mm5/merchant.mvc?Category_Code=$1
                David Hubbard
                CIO
                Miva
                [email protected]
                http://www.miva.com

                Comment

                Working...
                X