- Implemented configurable public URL rewriting.

What changed:
Added pretty URL helpers/default setting in 
[includes/db.php](/Users/tyemeclifford/Documents/GH/mediaplayer/includes/db.php).
Added root rewrite rules in 
[.htaccess](/Users/tyemeclifford/Documents/GH/mediaplayer/.htaccess):/v/<slug>
/all
/search/<query>

Added Admin → Settings “Public URL Style” toggle in 
[admin/settings.php](/Users/tyemeclifford/Documents/GH/mediaplayer/admin/settings.php), 
defaulting to pretty URLs.
Updated public/player/catalogue/embed/admin preview links to use the 
configured URL style.
Added redirects from legacy ?v= and ?q= URLs to pretty routes when 
rewriting is enabled.
Documented deployment and fallback behavior in 
[README.md](/Users/tyemeclifford/Documents/GH/mediaplayer/README.md).
This commit is contained in:
Ty Clifford
2026-06-24 13:16:55 -04:00
parent 0f262cab3f
commit 1abe5218ca
13 changed files with 187 additions and 30 deletions
+13 -1
View File
@@ -8,13 +8,14 @@ Styled to match the existing `gate.php` / `index.php` dark theme exactly.
## Requirements
- PHP 8.0+ with `pdo_sqlite`, `fileinfo` extensions
- Apache `mod_rewrite` for default pretty URLs, or switch to query URLs in Admin → Settings
- Write permissions on the `data/` and `media/` directories
---
## Installation
1. **Upload** all files to your web server (e.g. `/live/` or wherever `/index.php` lives).
1. **Upload** all files to your web server. To use domain-level pretty URLs such as `/v/my-video`, deploy the app at the web root.
2. **Set permissions** so PHP can write to these directories:
```bash
@@ -36,6 +37,7 @@ Styled to match the existing `gate.php` / `index.php` dark theme exactly.
/ ← web root (deploy here)
├── index.php ← Main player + catalogue (home page)
├── catalogue.php ← Full video catalogue browse page
├── .htaccess ← Pretty URL rewrite rules
├── includes/
│ ├── db.php ← SQLite bootstrap + helper functions
│ └── layout.php ← Shared HTML head, topbar, footer, pagination
@@ -84,6 +86,16 @@ Use **Admin → YouTube Importer** to paste a YouTube channel URL, `@handle`, or
The full catalogue page includes a public search for published videos only. Search matches video title, description, and slug; draft videos remain hidden.
### Public URLs
Pretty URLs are enabled by default:
- `/v/<slug>` plays a video
- `/all` lists all public videos
- `/search/<query>` searches public videos
You can switch to PHP query URLs in **Admin → Settings → Public URL Style** if your host does not support `.htaccess` rewrites.
### Catalogue Per-Page
Configurable in **Admin → Settings → Videos per page** (150).