From a8d95d39e08b8a14004729fd02f248260a1a01d9 Mon Sep 17 00:00:00 2001 From: David Polakovic Date: Fri, 19 Dec 2025 21:11:02 +0100 Subject: [PATCH] [FEAT] custom HTTP code messages, RFC 2324, server migration --- .htaccess | 38 +++++- README.txt | 23 ++-- Styles/styles.css | 4 + blog.php | 11 +- clicky-images.js | 50 ++++++-- dead-drop.php | 9 +- dir.php | 11 +- error/error.php | 308 ++++++++++++++++++++++++++++++++++++++++++++++ fruit.js | 2 +- index.php | 13 +- license.js | 16 +++ mars-clock.php | 15 +-- php/config.php | 149 +++++++++------------- php/dd2.php | 5 +- 14 files changed, 483 insertions(+), 171 deletions(-) mode change 100644 => 100755 .htaccess create mode 100644 error/error.php create mode 100644 license.js diff --git a/.htaccess b/.htaccess old mode 100644 new mode 100755 index fcc6cd4..4e5e71a --- a/.htaccess +++ b/.htaccess @@ -1,19 +1,51 @@ -RewriteEngine on +RewriteEngine On + +# Handle BREW method FIRST before HTTPS redirect +RewriteCond %{REQUEST_METHOD} ^BREW$ +RewriteRule ^ brew.php [L] + +# HTTPS redirect +RewriteCond %{HTTPS} off +RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] + +# Handle /error/### URLs - capture the error code and pass it to error.php +RewriteCond %{REQUEST_URI} ^/error/(\d+)/?$ +RewriteRule ^error/(\d+)/?$ /error/error.php?code=$1 [L] + +# Your existing rules +RewriteRule ^6e69636520747279$ /6E69636520747279 [R=301,L] RewriteCond %{THE_REQUEST} \s/([^.]+)\.php [NC] RewriteRule ^ /%1 [NE,L,R] + RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^(.*)/?$ /$1.php [L] - RewriteCond %{THE_REQUEST} \s/([^.]+)\.html [NC] RewriteRule ^ /%1 [NE,L,R] + RewriteCond %{REQUEST_FILENAME}.html -f RewriteRule ^(.*)/?$ /$1.html [L] - RewriteCond %{REQUEST_URI} !^/blogs/ [NC] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ blogs/$1 [L] +Options -Indexes + +# ErrorDocument declarations - all point to error.php in error/ folder + +# 400 +ErrorDocument 400 /error/error.php +ErrorDocument 403 /error/error.php +ErrorDocument 404 /error/error.php +ErrorDocument 408 /error/error.php +#ErrorDocument 418 /error/error.php +ErrorDocument 429 /error/error.php + +# 500 +ErrorDocument 500 /error/error.php +ErrorDocument 502 /error/error.php +ErrorDocument 503 /error/error.php +ErrorDocument 504 /error/error.php \ No newline at end of file diff --git a/README.txt b/README.txt index f2f5da4..471396e 100755 --- a/README.txt +++ b/README.txt @@ -1,20 +1,20 @@ my-website -A simple website that I run. Check it out on https://dpolakovic.space -Copyright 2023-2024, David Polakovic +A simple website that I run. Check it out on https://www.dpolakovic.space +Copyright 2023-2025, David Polakovic ABOUT: -This is my static, old school, 90's, web 1.0 website. I despise the responsiveness, +This is my old school, 90's, web 1.0 website. I despise the responsiveness, mobile design and client side computing. So I made html/php site to occupy little piece of cyberspace. Here is description of the files: -.htaccess - config file, so I don't have to write .php/.html in url -index.php - the "About page" with contacts (not much going on here) -blog.php - echoes blogs from blogs/ -dir.php - some links -lib.php - my book library in one table -gpg.html - page with my email gpg key -test.php - default test page for troubleshooting new features -rss.xml - RSS file for blog site (to be used with RSS reader) +.htaccess - config file, so I don't have to write .php/.html in url +index.php - the "About page" with contacts (not much going on here) +blog.php - echoes blogs from blogs/ +dir.php - useful links +gpg.html - page with my email gpg key +mars-clock - shows time on Mars +dead-drop - anonymous message exchange +rss.xml - RSS file for blog site (to be used with RSS reader) blogs/pics/ - pictures for blogs blogs/ - here I store the blogs @@ -22,6 +22,7 @@ php/ - php backend for this web + text files which I echo Pictures/ - directory with all pictures for sites (except the blogs) Styles/ - dir with font I use and CSS style file Zax/ - files for my other domain https://www.zax-game.com +error/ - dir with error.php file for custom HTTP status code messages NOTE: There are few more files (sites and config files) which run on the server. These diff --git a/Styles/styles.css b/Styles/styles.css index ba191f0..718c358 100755 --- a/Styles/styles.css +++ b/Styles/styles.css @@ -293,6 +293,10 @@ display: block; color: #545454; } +.fresh-link:visited { + color: rgb(0, 0, 238); +} + /* Navigation bar for blog page So here is modified nav bar with only one option (Go back) I put it as a secound style, because I don't want last child diff --git a/blog.php b/blog.php index bdbdbc1..24cc517 100755 --- a/blog.php +++ b/blog.php @@ -71,15 +71,8 @@ -