Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I write an HTML response from an .htaccess file

Apologies if this is a stupid question, but can I control the HTML response from a .htaccess file (Apache)?

In other words something like (psuedo code) Write <!DOCTYPE html><html>...[etc]

The reason I ask is because I would like to "take down" some sites in one "hit", but without replacing any files or having any other kind of holding page.

like image 853
LiverpoolsNumber9 Avatar asked Oct 15 '25 03:10

LiverpoolsNumber9


1 Answers

I found the answer myself, certainly worked for what I needed:

ErrorDocument 503 "<!DOCTYPE html><html><head><title>This website is undergoing maintenance</title></head><body style='font-family: sans-serif'><h1>This website is undergoing maintenance</h1></body></html>"
RewriteEngine On
RewriteRule .* - [R=503,L]

Hope this helps somebody

like image 177
LiverpoolsNumber9 Avatar answered Oct 18 '25 08:10

LiverpoolsNumber9