0

I need a welcome page for new visits. If a user don0t have the cookie stored, he will be redirected to welcome page. If the cookie is stored, nothing happens.

Header set Set-Cookie "visited=true"
RewriteEngine On RewriteBase /
RewriteCond %{HTTP_COOKIE} !^visited=true$ [NC]
RewriteRule .? /welcome.html [R=301,NC,L]

Cookie is working, but all users are being redirected.

Nathan C
  • 15,059
  • 4
  • 43
  • 62
lexolas
  • 31
  • 1
  • 5

1 Answers1

1

You need to change the order...you're setting the cookie before the engine. Move the Header line below your rewrite rule and it should work.

Nathan C
  • 15,059
  • 4
  • 43
  • 62