Skip to content

Instantly share code, notes, and snippets.

@davidejones
Last active February 14, 2017 19:34
Show Gist options
  • Save davidejones/e87c44fe6c93b72b79db to your computer and use it in GitHub Desktop.
Save davidejones/e87c44fe6c93b72b79db to your computer and use it in GitHub Desktop.
htaccess splash cookie login
RewriteCond %{REQUEST_URI} !=/maintenance.html
RewriteCond %{REQUEST_URI} !=/login.cfm
RewriteCond %{REQUEST_URI} !^/mobile/
RewriteCond %{REQUEST_FILENAME} !\.(gif|jpe?g|png|css|js|swf|xml|ttf|eot|woff|svg|pdf)$
RewriteCond %{HTTP_COOKIE} !^.*splash.*$ [NC]
RewriteRule ^(.*)$ /maintenance.html [R=307,NC,L]
Visiting any url will take you to the splash page maintenance.html (excluding login.cfm and images/css/fonts that might be used on splash, also allow mobile site)
To bypass visit login.cfm
RewriteCond %{REQUEST_URI} !=/maintenance.html
RewriteCond %{REQUEST_URI} !=/login.cfm
RewriteCond %{REQUEST_FILENAME} !\.(gif|jpe?g|png|css|js|swf|xml|ttf|pdf)$
RewriteCond %{HTTP_COOKIE} !^.*splash.*$ [I]
RewriteRule ^(.*)$ /maintenance.html [R=307,I,L]
<cfcookie name="splash" value="1">
<cflocation url="/index.cfm" addToken="no"/>
<!---
If there are issues with still being able to access the site add a manual redirect to a
.cfm file used throughout the website e.g base3 page.cfm
--->
<cfif !StructKeyExists(Cookie, 'splash')>
<cflocation url="/index.splash.htm"/>
<cfabort/>
</cfif>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment