Skip to content

Instantly share code, notes, and snippets.

@justingivens
Created October 21, 2021 19:15
Show Gist options
  • Save justingivens/00d6073fa2edf379f1b3c7ec1c6af87b to your computer and use it in GitHub Desktop.
Save justingivens/00d6073fa2edf379f1b3c7ec1c6af87b to your computer and use it in GitHub Desktop.
cpanel - lsws - geoip - wp standard htaccess with country code blocking
<IfModule mod_geoip.c>
<FilesMatch "wp-login.php|xmlrpc.php">
RewriteEngine On
#RewriteCond %{ENV:GEOIP_COUNTRY_CODE} !^(US)$ # If using MOD_GEOIP with Litespeed Web Server
#RewriteCond %{HTTP:CF-IPCOUNTRY} !^(US)$ # If using CloudFlare
RewriteRule ^(.*)$ - [F,L]
</FilesMatch>
</IfModule>
# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php74” package as the default “PHP” programming language.
<IfModule mime_module>
AddHandler application/x-httpd-ea-php74 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment