• I’m using W3 Total Cache page caching, so this can’t be done in PHP.

    I have an .htaccess redirect working on html pages, but I need to figure out how to get this working in WordPress .htaccess. I don’t understand .htaccess well enough to understand what needs to be done. The point is to redirect to a landing page if the visitor does not have the cookie, which will then be set by the landing page. That way, the first visit will get the redirect, but not subsequent pageloads.

    RewriteEngine on
    RewriteRule ^.+$ – [L]
    RewriteCond %{HTTP_COOKIE} !^.*mts_popup=(\d+).*$ [NC]
    RewriteRule . /$1 [R=301,L]
    RewriteRule . /bio [R=301,L]

    adapted from https://stackoverflow.com/questions/3978726/how-to-do-htaccess-redirect-based-on-cookie-value

The topic ‘redirect in .htaccess based on cookie’ is closed to new replies.