Announcement

Collapse
No announcement yet.

URL to a specific product

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

    URL to a specific product

    To link to a specific product (from a page outside of the actinic shop) you can use this link:-

    Code:
    www.stuff-for-computers.co.uk/cgi-bin/ss000000.pl?PRODREF=171&NOLOGIN=1&ACTINIC_REFERRER=http://www.stuff-for-computers.co.uk/acatalog/
    Where 171 is the product reference of the product.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    That URL is a bit long. So here's a php program (product.php) I wrote to shorten it:-

    Code:
    <?php
    
    $prod = $_SERVER['QUERY_STRING'];
    
    require "http://www.stuff-for-computers.co.uk/cgi-bin/ss000000.pl?PRODREF=$prod&NOLOGIN=1&ACTINIC_REFERRER=http://www.stuff-for-computers.co.uk/acatalog/";
    
    ?>
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Now I use this URL to link to products:-

    http://www.stuff-for-computers.co.uk/product.php?171

    anthony@sfc
    Webmaster at Stuff for Computers
    www.stuff-for-computers.co.uk
    anthony@stuff-for-computers.co.uk

    #2
    Or you can add the following to a .htaccess file:

    Assuming your product code is between 1 and 5 numbers long:

    RewriteEngine on
    RewriteRule ([0-9]{1,5}$) http://www.stuff-for-computers.co.uk/cgi-bin/ss000000.pl?PRODREF=$1&NOLOGIN=1&ACTINIC_REFERRER=http://www.stuff-for-computers.co.uk/acatalog/

    Then you can refer to the link:

    http://www.stuff-for-computers.co.uk/171

    >>Example
    http://www.johnsons-seeds.com - Actinic plugins, remote add to cart and custom CMS
    http://www.dtbrownseeds.co.uk - More seeds and plants....
    http://www.mr-fothergills.co.uk - Well it used to be Actinic...

    Comment


      #3
      David,

      That's quite tidy. What would be the statement to make that a permanent 301 redirect rather than the default temporary 302 redirect?

      The problem with a temporary redirect is that google (and possibly other SEs) will consider it to be a page in it's own right, thus reducing the PR (and anchor text content) of the destination page and creating an indexed page with duplicate content.

      Mike
      -----------------------------------------

      First Tackle - Fly Fishing and Game Angling

      -----------------------------------------

      Comment


        #4
        Well that's neat little script, thanks Anthony
        David
        Mandrake Press Ltd

        <a href="http://www.mandrake-press.co.uk" target="_blank">www.mandrake-press.co.uk</a>

        Comment


          #5
          Just to complete the options on doing this.

          If you're not using customer accounts then you can link directly to the products without going via the cgi-bin. This is faster and better for the search engines.

          The format is just:

          http://www.url.com/acatalog/page.html#aproductreference

          So using the example from above:

          http://www.stuff-for-computers.co.uk...tors.html#a171
          -----------------------------------------

          First Tackle - Fly Fishing and Game Angling

          -----------------------------------------

          Comment


            #6
            Revised code for permanent (301) redirection:

            RewriteEngine on
            RewriteRule ([0-9]{1,5}$) http://www.stuff-for-computers.co.uk/cgi-bin/ss000000.pl?PRODREF=$1&NOLOGIN=1&ACTINIC_REFERRER=http://www.stuff-for-computers.co.uk/acatalog/ [R=301,L]

            The R=301 is the provided status code. Not sure on the L, I used to know.
            http://www.johnsons-seeds.com - Actinic plugins, remote add to cart and custom CMS
            http://www.dtbrownseeds.co.uk - More seeds and plants....
            http://www.mr-fothergills.co.uk - Well it used to be Actinic...

            Comment

            Working...
            X