Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2007
    Location
    Pennsylvania
    Posts
    806
    Plugin Contributions
    0

    Default htaccess rewrite or redirect

    Hello All,
    Occasionally folks link to us by copying the url of the page their on which in some cases includes the zenid. I'm wondering how using htaccess I can catch visits of a specific zenid landing the visitor on the page their trying to visit, but with their own zenid. Everything I've done at best results in "server not redirecting properly".

    Ultimate SEO Urls is being used here.

    I want to change

    Code:
    https://www.example.com/the-94-inch-thing-p-11141.html?zenid=5df4a2f36h5fr4aa47f5g2gh4d7t
    to
    Code:
    https://www.example.com/the-94-inch-thing-p-11141.html
    Thank You,
    John

  2. #2
    Join Date
    Feb 2007
    Location
    Pennsylvania
    Posts
    806
    Plugin Contributions
    0

    Default Re: htaccess rewrite or redirect

    ... yes I realize I used "their" instead of "they're". I really have no idea why I did this. Brain fart??? Well it's been too long and I can no longer edit the original post...

  3. #3
    Join Date
    Jul 2012
    Posts
    16,718
    Plugin Contributions
    17

    Default Re: htaccess rewrite or redirect

    While USU is not "responsible" for this (per se), there is/would be a fault to this plan for the following reason(s).

    The zenid is attached to all zen_href_link generated links on initial visit (initiation of the session) and is intended to be received by the ZC software as a parameter on the url.
    The htaccess if it had a "single" rule to remove the zenid and do nothing else would prevent ZC from seeing the zenid and if not mistaken would basically regenerate the zenid. Therefore all links would appear as having a zenid not just those that were first generated and then visited.

    In a way, though not foolproof because product are also shown on the first page is to "bury" the product further down so that it is not as likely for there to be a zenid linkable product at or near the landing page.

    Long and short of it, I'd be interested to see what resolution is proposed for this issue, though I think I know at least the immediate response.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  4. #4
    Join Date
    Feb 2007
    Location
    Pennsylvania
    Posts
    806
    Plugin Contributions
    0

    Default Re: htaccess rewrite or redirect

    yeah, I know seo urls isn't responsible, just figured I'd throw that in for anyone wondering why the url has the structure that it does. I know what zenid is and what it's used for. I'm looking for a working htaccess resolution to this issue I'm having here.

    mc... what did you even just say? are you trying to boost your post count here?? You have over 10 thousand posts here in just a few years and are far less than helpful. What's the point in posting all of the nonsense that you just posted?

    Please someone with some serious htaccess experience please help me out here.

    Thank you,
    John

  5. #5
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: htaccess rewrite or redirect

    Quote Originally Posted by bumba000 View Post
    Hello All,
    Occasionally folks link to us by copying the url of the page their on which in some cases includes the zenid. I'm wondering how using htaccess I can catch visits of a specific zenid landing the visitor on the page their trying to visit, but with their own zenid. Everything I've done at best results in "server not redirecting properly".

    Ultimate SEO Urls is being used here.

    I want to change

    Code:
    https://www.example.com/the-94-inch-thing-p-11141.html?zenid=5df4a2f36h5fr4aa47f5g2gh4d7t
    to
    Code:
    https://www.example.com/the-94-inch-thing-p-11141.html
    Thank You,
    John
    This may work (or not).
    Code:
    RewriteCond %{QUERY_STRING} ^zenid=1$ 
    RewriteRule ^/(.*) http://www.yoursite.com/$1? [L,R=permanent]

    Meanwhile, I don't think anyone is going to be impressed at your disparaging remarks to mc12345678. Yes, he does post a lot, but I really doubt it has anything to do with gaining any points for the number of posts (there are far easier ways to do that). I do agree that sometimes it can be a little difficult to 'decode' what he writes (no offence intended), but at the same time, what he writes is rarely incorrect or misleading, just a little hard to follow at times.

    Basically, what he was saying is that a theoretical 'simple' solution, such as the one I have given, may not work, and could even lead to aggravating the situation by causing the now removed zenid to be regenerated in places/situations where it wouldn't normally be needed, and I will expand on this and suggest it could even cause an infinite loop - with the page(s) timing out with a 'Too many redirects' error.

    So, although the simple solution given *may* work, you will need to 'suck it and see' - and if you do experience problems such as those mentioned then the rules will need to get considerably more complicated - and it is even *possible* that this problem can't be solved via the .htaccess anyway.

    Cheers
    RodG

  6. #6
    Join Date
    Jul 2012
    Posts
    16,718
    Plugin Contributions
    17

    Default Re: htaccess rewrite or redirect

    So, not an htaccess "solution", I have tried to do some testing; however, between the myriad of browsers, needs to clear cache/cookies, individual settings within the browser(s), various ZC versions on which this was tried and almost more importantly the server hosting the store, it appeared that I was able to arrive at a store (any page), navigate, and login without ever seeing a zenid on the uri with SESSION_FORCE_COOKIE_USE set to 1 as found in admin->sessions->Force Cookie Use.

    Now I did find that occasionally and again browser dependent as it seemed, that if cookies were disabled, then a number of different observations were made. One, the zenid might appear on the uri (defeats the requested purpose/goal), two it may not be possible to login/checkout without enabling cookies (message is presented to customer from ZC identifying the use of cookies and that they are needed).

    Beyond that, in a way it seems like a business need has been presented (which is one strong case for some of the developers to step in or independently make contact); however, it is also along the same path of discussion of how to never include the zenid on the uri possibly with a bit of a "twist". The discussion of why the zenid appears has been had for years with or without a URI rewriter (hence the original comment that not necessarily applicable to USU specifically (per se)). If it remained on the URI through subsequent clicks, then it would be expected that further assistance would likely be afforded.

    Now, all that said as well, I tested arriving at a ZC 1.5.4 and a ZC 1.5.5 each site feeding a "known" zenid, and never did the actions of the two visitors mingle. Again, a lot of various settings and methodic operations necessary to fully test the scenario, I even went so far as to modify the session directory as identified in admin->configuration->sessions to be both the same (/tmp directory) between the two sites (each a sub-domain off of the main site) and each having their own directory (cache directory of the store). While it was not expected for the two independent sites to comingle visit data, the same test was performed from two different devices as well as when on a device using two different browsers (though more than a total of two were used/tried).

    In otherwords, test conditions for attempt to hijack the session were:
    Site A:
    two browsers, same zenid
    two devices (each a different browser), same zenid
    independent session directory (cache of site A)
    combined session directory (/tmp of server)
    Cookies enabled on browser.
    Cookies disabled.
    Force Cookie Use (on or off)
    PHP 7.0.x

    Site B:
    two browsers, same zenid
    two devices (each a different browser), same zenid
    independent session directory (cache of site A)
    combined session directory (/tmp of server)
    Cookies enabled on browser.
    Cookies disabled.
    Force Cookie Use (on or off)
    PHP 5.6.x

    Site A & Site B:
    combined session directory (/tmp of server)
    two browsers one on site A, other on site B, same zenid
    two devices (each a different browser), one on site A, other on site B, same zenid

    At no time, try as I might could I get one "screen" to show anything related to another's.
    Page source was reviewed and the securityToken was different in each browser.

    Even tried to modify the securityToken and submit a page request, which was responded with a ZC message that I was "doing something wrong"... (Didn't actually state that, but I knew what I did and ZC responded to prevent what I was trying.)

    I doubt that I used a highly methodical method (ie. I couldn't tell you which browser prevented login/checkout and whether there was some cookie/cache like remnant somewhere in the computer) to accomplish the above, but as you may also see, there are a lot of potential variables to attempt to modify and perhaps a good/better testing plan could be made. Also because of the potential for having missed some setting/clearing of settings between all of that testing and the time involved to try to prove/disprove a situation where I personally have little invested, I encourage also trying these things out independently. Afterall safety in numbers right? :)
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 

Similar Threads

  1. How do I use htaccess to not rewrite a subdomain?
    By Danielle in forum General Questions
    Replies: 3
    Last Post: 15 Feb 2012, 05:04 AM
  2. .htaccess rewrite with folders and Private SSL?
    By littlehawk in forum Templates, Stylesheets, Page Layout
    Replies: 6
    Last Post: 14 Sep 2009, 07:10 PM
  3. How to change .htaccess to rewrite the url? - Hard
    By musicpxg in forum General Questions
    Replies: 0
    Last Post: 30 Jul 2009, 09:05 AM
  4. htaccess rewrite question
    By jeking in forum General Questions
    Replies: 12
    Last Post: 6 Mar 2008, 05:38 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR