Support » Plugins » htaccess redirects in conjunction with Woocommerce page-caching

  • Hi all. I have a Woocommerce site configured to Geolocate with page-caching support, and of course this appends a query string to the end of all URLs, e.g. http://www.mysite.com/?v=1234567890

    I’ve added rewrite rules to my .htaccess file in order to redirect from URL #1 to URL #2, while capturing part of URL #1 and appending it to URL #2 in a query string that can be captured in Analytics.

    Example URL #1: http://www.mysite.com/v/ab0
    Example URL #2: http://www.mysite.com/support/product1

    So here’s what I have for the Rewrite rule in my .htaccess file:

    # BEGIN URL redirects
    <IfModule mod_rewrite.c>
    RewriteEngine On
    
    	RewriteRule ^/?v/(.*)$ http://www.mysite.com/support/product1/index.php?param1=randomstuff&param2=captured_$1 [R=301,L]
    </IfModule>

    Note: I appended “/index.php” to the permalink URL for the product1 page. Hopefully that’s correct.

    What I get is a 404 at URL “www.mysite.com/v/ab0/?v=1234567890”

    Now, I’m a newb when it comes to Apache and using regex in config files like this. While I have full intentions to put the time in to actually learn what I’m doing here (incl. best practices, etc.), I’ve just learned of this requirement and this site is currently live… I need to resolve this issue ASAP.

    Many thanks for any help!

  • The topic ‘htaccess redirects in conjunction with Woocommerce page-caching’ is closed to new replies.