Last active
July 30, 2026 12:23
-
-
Save mdpuma/db089e5f108f7d4dc457 to your computer and use it in GitHub Desktop.
nginx + apache, http to https redirect
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Require ip 185.181.228.28 89.28.17.33 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # cat httpd.conf | |
| SetEnvIf X-Forwarded-Proto https HTTPS=on | |
| # cat .htaccess | |
| RewriteCond %{ENV:HTTPS} !=on | |
| RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L] | |
| RewriteEngine on | |
| RewriteCond %{HTTP:X-Forwarded-Proto} !https | |
| RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L] | |
| RewriteEngine on | |
| RewriteCond %{HTTPS} !=on | |
| RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L] | |
| RewriteCond %{HTTP_USER_AGENT} ".*meta-externalagent/1\.1.*" [OR] | |
| RewriteCond %{HTTP_USER_AGENT} ".*meta-webindexer/1\.1.*" [OR] | |
| RewriteCond %{HTTP_USER_AGENT} ".*ClaudeBot/1\.0.*" | |
| RewriteRule .* - [F,L] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment