╔═══════════════════════════════════════════════════════════════╗
║                                                               ║
║            NUCLEAR FIX - GET YOUR SHIT WORKING                ║
║                                                               ║
╚═══════════════════════════════════════════════════════════════╝

ONE COMMAND TO FIX EVERYTHING:

chmod +x nuclear_fix.sh
sudo ./nuclear_fix.sh


WHAT IT DOES:

✓ Moves nnfss2.com from /var/www/html to /var/www/nnfss2.com/public_html
✓ Creates proper directory structure (public_html, logs, backups)
✓ Moves ALL your files to the correct location
✓ Sets correct permissions (www-data:www-data)
✓ Creates BULLETPROOF .htaccess with 404 redirect
✓ Enables ALL required Apache modules (rewrite, ssl, headers, expires, deflate)
✓ Creates/fixes virtual host with AllowOverride All (THIS IS KEY!)
✓ Fixes ALL other websites in /var/www/ too
✓ Disables default Apache site
✓ Tests configuration
✓ Reloads Apache
✓ Verifies 404 redirect works
✓ Makes automatic backups of everything


BACKUP LOCATION:

Everything is backed up to:
/root/nuclear-backup-[timestamp]/

If something goes wrong, your files are safe.


WHAT IT FIXES:

1. nnfss2.com not in proper location
2. .htaccess not being read (AllowOverride issue)
3. 404 errors not redirecting to homepage
4. Missing Apache modules
5. Wrong permissions
6. All subdomain issues


AFTER RUNNING:

Test these URLs:
  http://nnfss2.com/           ← Should work
  http://nnfss2.com/blah       ← Should redirect to homepage
  http://blah.nnfss2.com/      ← Should work

ALL should work now!


FILES CREATED:

/var/www/nnfss2.com/
├── public_html/              ← Your website files here
│   ├── .htaccess            ← 404 redirect magic
│   └── index.html           ← Default homepage
├── logs/                    ← Apache logs
│   ├── error.log
│   └── access.log
└── backups/                 ← For your use

/etc/apache2/sites-available/nnfss2.com.conf  ← Virtual host


THE .htaccess FILE:

The script creates a bulletproof .htaccess with:
• ErrorDocument 404 /
• RewriteRule fallback method
• Security headers
• Compression
• Browser caching
• File protection


THE VIRTUAL HOST:

AllowOverride All    ← THIS IS THE CRITICAL LINE!

Without this, Apache IGNORES your .htaccess file.
The script fixes this automatically.


IF IT STILL DOESN'T WORK AFTER RUNNING:

1. Check the output - it shows exactly what it did
2. Test: curl -I http://nnfss2.com/test
3. Check logs: tail -f /var/www/nnfss2.com/logs/error.log
4. Verify: grep "AllowOverride" /etc/apache2/sites-available/nnfss2.com.conf


JUST RUN IT:

sudo ./nuclear_fix.sh

That's it. It will ask for confirmation, then fix EVERYTHING.


═══════════════════════════════════════════════════════════════

This script is aggressive and comprehensive.
It WILL move your files and change your Apache config.
But it makes backups first, so it's safe.

Stop fucking around with manual fixes.
Just run the script.

═══════════════════════════════════════════════════════════════
