Skip to content

Instantly share code, notes, and snippets.

@zero-master
Last active February 14, 2022 20:07
Show Gist options
  • Select an option

  • Save zero-master/57ce7f5091503ca637747df5ba4fe71d to your computer and use it in GitHub Desktop.

Select an option

Save zero-master/57ce7f5091503ca637747df5ba4fe71d to your computer and use it in GitHub Desktop.

Revisions

  1. zero-master revised this gist May 28, 2018. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions GDPR.md
    Original file line number Diff line number Diff line change
    @@ -40,6 +40,7 @@ RewriteCond %{ENV:Country} SI
    RewriteCond %{ENV:Country} ES
    RewriteCond %{ENV:Country} SE
    RewriteCond %{ENV:Country} GB
    RewriteRule ^(.*)$ http://yourwebsite/blockedGDPR/ [R,L]
    ```

  2. zero-master revised this gist May 28, 2018. No changes.
  3. zero-master created this gist May 28, 2018.
    67 changes: 67 additions & 0 deletions GDPR.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,67 @@
    Turn on Cloudflare IP Geolocation
    ---
    https://support.cloudflare.com/hc/en-us/articles/200168236-What-does-Cloudflare-IP-Geolocation-do-


    In your `.htaccess` file:
    ---

    ```
    RewriteEngine on
    # Set the CF-IPCountry header value as "Country" variable
    SetEnvIf CF-IPCountry "(.*)$" Country=$1
    RewriteCond %{ENV:Country} AT
    RewriteCond %{ENV:Country} BE
    RewriteCond %{ENV:Country} BG
    RewriteCond %{ENV:Country} CY
    RewriteCond %{ENV:Country} CZ
    RewriteCond %{ENV:Country} DK
    RewriteCond %{ENV:Country} EE
    RewriteCond %{ENV:Country} FI
    RewriteCond %{ENV:Country} FR
    RewriteCond %{ENV:Country} DE
    RewriteCond %{ENV:Country} GR
    RewriteCond %{ENV:Country} HU
    RewriteCond %{ENV:Country} HR
    RewriteCond %{ENV:Country} IE
    RewriteCond %{ENV:Country} IT
    RewriteCond %{ENV:Country} LV
    RewriteCond %{ENV:Country} LT
    RewriteCond %{ENV:Country} LU
    RewriteCond %{ENV:Country} MT
    RewriteCond %{ENV:Country} NL
    RewriteCond %{ENV:Country} PL
    RewriteCond %{ENV:Country} PT
    RewriteCond %{ENV:Country} RO
    RewriteCond %{ENV:Country} SK
    RewriteCond %{ENV:Country} SI
    RewriteCond %{ENV:Country} ES
    RewriteCond %{ENV:Country} SE
    RewriteCond %{ENV:Country} GB
    RewriteRule ^(.*)$ http://yourwebsite/blockedGDPR/ [R,L]
    ```

    Create a file named `index.html` in `blockedGDPR` directory with the below content:
    ---
    ```
    <html>
    <title>
    GDPR Block
    </title>
    <body>
    We are unable to bear GDPR compliance cost at the moment.
    </body>
    <style>
    body {
    font-family: 'Avenir', Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color: #2c3e50;
    margin-top: 20px;
    }
    </style>
    </html>
    ```