So I have a site that is run at example.com and serves as a gateway for the Drupal site that runs in folder /drupal
. What I want to do, I want to set a cookie on that gateway page on login and then allow access to example.com/drupal and if the cookie is not set, redirect back to example.com.
But my problem is, the rule does not work in the /drupal
folder in drupal .htaccess, but I tested it and it works fine in the root directory.
The rule is as follows
RewriteCond %{HTTP_COOKIE} !CookieName=test [NC]
RewriteRule .* http://example.com [L]
But for some reason, the rule does not work here and the user can access the /drupal folder without the cookie, but if I place the same rule in / root, then the redirect happens since no cookie with that name is set.
drupal/.htaccess
– Legislate