From 19f86290ffef8fedab3df90db3b7c2bfb9301f25 Mon Sep 17 00:00:00 2001 From: Edmund Tan Date: Tue, 22 Jul 2025 02:17:42 +0800 Subject: [PATCH] fix install script6 --- UI/.htaccess | 16 ++++++------ UI/test-assets.php | 61 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 7 deletions(-) create mode 100644 UI/test-assets.php diff --git a/UI/.htaccess b/UI/.htaccess index bb04789..00a48ed 100644 --- a/UI/.htaccess +++ b/UI/.htaccess @@ -1,20 +1,22 @@ # ZitiNexus Router Enrollment UI - Apache Configuration # This file helps serve assets correctly when document root is not set to /public/ -# Redirect to public directory for main pages RewriteEngine On -# Serve assets directly from assets directory +# Serve assets directly from assets directory (highest priority) RewriteRule ^assets/(.*)$ assets/$1 [L] -# Redirect main pages to public directory -RewriteRule ^$ public/index.php [L] -RewriteRule ^index\.php$ public/index.php [L] -RewriteRule ^dashboard\.php$ public/dashboard.php [L] +# Serve root-level PHP files directly (for current setup) +RewriteCond %{REQUEST_FILENAME} -f +RewriteRule ^(index|dashboard)\.php$ $1.php [L] -# Handle other requests +# Fallback: redirect to public directory only if file doesn't exist in root +RewriteRule ^$ index.php [L] + +# Handle other requests only if file doesn't exist in root RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d +RewriteCond %{REQUEST_URI} !^/assets/ RewriteRule ^(.*)$ public/$1 [L] # Security: Deny access to sensitive directories diff --git a/UI/test-assets.php b/UI/test-assets.php new file mode 100644 index 0000000..a8fb08e --- /dev/null +++ b/UI/test-assets.php @@ -0,0 +1,61 @@ +Asset Path Test"; + +// Test direct paths (for root-level access) +echo "

Direct Asset Paths (Root Level Access)

"; +echo "

CSS: assets/css/style.css

"; +echo "

JS: assets/js/app.js

"; + +// Check if files exist +echo "

File Existence Check

"; +echo "

CSS exists: " . (file_exists('assets/css/style.css') ? 'YES' : 'NO') . "

"; +echo "

JS exists: " . (file_exists('assets/js/app.js') ? 'YES' : 'NO') . "

"; + +// Test actual links +echo "

Test Links

"; +echo '

Test CSS Link

'; +echo '

Test JS Link

'; + +// Show current directory +echo "

Current Directory Info

"; +echo "

Current working directory: " . getcwd() . "

"; +echo "

Script filename: " . $_SERVER['SCRIPT_FILENAME'] . "

"; +echo "

Document root: " . $_SERVER['DOCUMENT_ROOT'] . "

"; + +// List assets directory +echo "

Assets Directory Contents

"; +if (is_dir('assets')) { + echo ""; +} else { + echo "

Assets directory not found!

"; +} + +// Test with HTML +echo "

HTML Test

"; +echo '
This text should be red if CSS is not loading
'; +echo ''; +echo '
This should be styled if CSS loads
'; +?>