- Fixed the subdirectory loading issue.

Changed:
[app/View.php](/Users/tyemeclifford/Documents/GH/blog/app/View.php): 
generated URLs now honor a base path like /blog.
[app/Config.php](/Users/tyemeclifford/Documents/GH/blog/app/Config.php): 
added base_path support and derives it from base_url or SCRIPT_NAME.
[app/App.php](/Users/tyemeclifford/Documents/GH/blog/app/App.php): route 
parsing strips the base path, and PHP can safely serve theme/upload 
assets for virtual subdirectory previews.
[.htaccess](/Users/tyemeclifford/Documents/GH/blog/.htaccess): removed 
hardcoded RewriteBase /.
[themes/neon/layout.php](/Users/tyemeclifford/Documents/GH/blog/themes/neon/layout.php): 
root-relative social links like /feed.xml now become /blog/feed.xml.
[README.md](/Users/tyemeclifford/Documents/GH/blog/README.md): 
documented subdirectory setup.
This commit is contained in:
Ty Clifford
2026-07-04 19:54:54 -04:00
parent 782b983bf4
commit 94aea8501f
8 changed files with 140 additions and 5 deletions
+9 -1
View File
@@ -23,7 +23,15 @@ spl_autoload_register(static function (string $class): void {
}
});
if (PHP_SAPI !== 'cli' && session_status() !== PHP_SESSION_ACTIVE) {
$isPublicAssetRequest = static function (): bool {
$path = (string) parse_url((string) ($_SERVER['REQUEST_URI'] ?? ''), PHP_URL_PATH);
$route = (string) ($_GET['route'] ?? '');
return (bool) preg_match('#/(themes/[a-z0-9_-]+/assets/.+|bl-content/uploads/.+)$#', $path)
|| (bool) preg_match('#^(themes/[a-z0-9_-]+/assets/.+|bl-content/uploads/.+)$#', $route);
};
if (PHP_SAPI !== 'cli' && session_status() !== PHP_SESSION_ACTIVE && !$isPublicAssetRequest()) {
session_start([
'cookie_httponly' => true,
'cookie_samesite' => 'Lax',