Redirect if cookie is not present

Job ID: 30766536

Budget: €30 – €250 EUR

We want our server to redirect all URLs to a login page if a specific cookie is not present. The URL path must be also sent to the login page. Some file extensions (jpg,png,gif,pdf,txt) will be excluded from this rule. This has been partially implemented via htaccess but help is needed. Specifics will be given to anyone interested.

Example:
• User visits 'mysite.com/subfolder1/subfolder2?var=foo'
• If the cookie is not present, user will be redirected to 'mysite.com/login'
• After successfully logged in, user will be redirected again to the original URL 'mysite.com/subfolder1/subfolder2?var=foo'

*Any URL variables must be kept
** The login page and cookie is already implemented
Related categories: PHP Apache MySQL Server