diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..9d6257c --- /dev/null +++ b/.htaccess @@ -0,0 +1,10 @@ +DirectoryIndex index.php + + + RewriteEngine On + + RewriteRule ^v/([^/]+)/?$ index.php?v=$1 [B,L,QSA] + RewriteRule ^all/?$ catalogue.php [L,QSA] + RewriteRule ^search/?$ catalogue.php [L,QSA] + RewriteRule ^search/(.+)/?$ catalogue.php?q=$1 [B,L,QSA] + diff --git a/README.md b/README.md index 411c31a..4a03ae5 100644 --- a/README.md +++ b/README.md @@ -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/` plays a video +- `/all` lists all public videos +- `/search/` 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** (1–50). diff --git a/admin/add.php b/admin/add.php index 5c85856..e7c1037 100644 --- a/admin/add.php +++ b/admin/add.php @@ -170,7 +170,7 @@ render_head('Add Video — Admin', '