Forum Moderators: open
Getting started: header-based access controlsOoh, I'd forgotten that thread--and, in particular, had forgotten how many years ago it was.
RewriteCond %{HTTP_REFERER} ^.*example-leech-domain-name.*$ [NC]
RewriteRule .*\.(jpg|gif|png)$ - [F,NC]
SetEnvIf User-Agent ^$ no_agent
SetEnvIf Accept ^$ no_accept followed by the "require env" code within "requirenone" wrapper. This does limit my ability to do logging and inspect headersIt doesn't, really; you can include a php footer in an otherwise static-html page using SSI (Server-Side Include). No, you don't need to change all the page extensions to .shtml; just add a directive in htaccess.
Handling renamed pages (using "RedirectMatch permanent")Combining mod_alias (Redirect by that name) and mod_rewrite will not break anything, but most people will strongly advise against it because things won't necesssarily execute in the order you want them to. Luckily it's simple to change all your mod_alias rules to mod_rewrite syntax.
Most of my website is static files, so there's actually more load on my server for it to load the php parser in order to serve the 40x.php page.Did you explain at some point why it has to be php? There are several alternatives to a 403 page, including returning a literal string that you specify in htaccess.
In those days it required the "include" to be on each page.My personal Final Frontier was allowing BBedit to do an unsupervised multi-file replace to add the appropriate line to each and every page. This would have been at least ten years after I first met Regular Expressions; it takes time to work up the courage.
Do sites inevitably end up with (black|white)lists thousands of lines long?Oh, absolutely not, except in the occasional case of an unfortunate newbie who doesn't know about IP ranges and tries to block by exact-to-the-last-digit addresses.
When only the best will do xxx.xxx.xxx.xxxOr possibly
SetEnvIf Accept ^$ no_accept "Cache-Control": "no-cache",
"user-agent": "WhatsApp/2.2338.9 W",
"host": "www.example.com",
"X-REWRITE-URL": "/path-to-url-shared/",
"connection": "Keep-Alive",
"Accept-Encoding": "gzip, deflate",
"content-length": "0" <meta property="og:title" content="ExAmple.com: Widgets"/>
<meta property="og:url" content="https://www.example.com/"/>
<meta property="og:image" content="https://www.example.com/path_to_image_display_in_snipet.png"/>
<meta property="og:image:width" content="400"/>
<meta property="og:image:height" content="400"/>
<meta property="og:type" content="product"/>
<meta property="og:site_name" content="ExAmple.com"/>