Announcement

Collapse
No announcement yet.

htaccess and short links question - getting ?source=google-adwords to work

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

    htaccess and short links question - getting ?source=google-adwords to work

    Hello

    I use the old category tree from Emporium Plus which creates urls like
    http://www.domain.com/c/Examplecat/Example-Cat.html
    Here Examplecat is an actual category

    If I add
    http://www.domain.com/c/Examplecat/Example-Cat.html?source=advertiser-ad
    The source part does not come through in my analytics

    CURRENT HTACESS

    RewriteCond %{REQUEST_URI} ^/p/(.*)/(.*) [NC]
    RewriteRule (.*) /mm5/merchant.mvc?Screen=PROD&Product_Code=%1&Store_Cod e=001 [L,QSA]
    RewriteCond %{REQUEST_URI} ^/pc/(.*)/(.*)/(.*) [NC]
    RewriteRule (.*) /mm5/merchant.mvc?Screen=PROD&Product_Code=%1&Category_ Code=%2&Store_Code=001 [L,QSA]
    RewriteCond %{REQUEST_URI} ^/c/(.*)/(.*) [NC]
    RewriteRule (.*) /mm5/merchant.mvc?Screen=CTGY&Category_Code=%1&Store_Co de=001 [L,QSA]

    What I think I should do

    RewriteCond %{REQUEST_URI} ^/c/(.*)/(.*)?source(.*) [NC]
    RewriteRule (.*) /mm5/merchant.mvc?Screen=CTGY&Category_Code=%1&Store_Co de=001&source=%3 [L,QSA]

    Am I correct?

    I have been reading all kinds of articles on htacccess - and decided that it might be wiser to ask someone who has done this before - before I start experimenting for hours.

    Any Help appreciated.

    Thanks
    Sam

    #2
    Re: htaccess and short links question - getting ?source=google-adwords to work

    The REQUEST_URI variable never sees the query string so that wouldn't help. However, your use of the QSA tag should be causing your original query string to be appended to the new one, so it's odd that you are not seeing that occur.

    http://httpd.apache.org/docs/current....html#flag_qsa

    When the replacement URI contains a query string, the default behavior of RewriteRule is to discard the existing query string, and replace it with the newly generated one. Using the [QSA] flag causes the query strings to be combined.

    Consider the following rule:

    RewriteRule /pages/(.+) /page.php?page=$1 [QSA]

    With the [QSA] flag, a request for /pages/123?one=two will be mapped to /page.php?page=123&one=two. Without the [QSA] flag, that same request will be mapped to /page.php?page=123 - that is, the existing query string will be discarded.
    Could there be some other issue elsewhere in the code where it's just not reading the query string correctly?
    David Hubbard
    CIO
    Miva
    [email protected]
    http://www.miva.com

    Comment


      #3
      Re: htaccess and short links question - getting ?source=google-adwords to work

      David,

      Thank you for your help.

      It could be a cookie thing.

      I have to figure out the actual url being delivered to miva - is there a way to capture that? May be a log file or somethiing?

      Thanks
      Sam

      Comment


        #4
        Re: htaccess and short links question - getting ?source=google-adwords to work

        http://www.domain.com/c/Examplecat/E...=advertiser-ad should be rewritten internally by apache to work as if the request had been for:

        Code:
        http://www.domain.com/mm5/merchant.mvc?Screen=CTGY&Category_Code=Examplecat&Store_Code=001&source=advertiser-ad
        Last edited by ILoveHostasaurus; 02-22-15, 09:09 AM.
        David Hubbard
        CIO
        Miva
        [email protected]
        http://www.miva.com

        Comment

        Working...
        X