# How to Download and Deploy to cPanel

## ✅ Build Complete!

Your production build is ready at: `/app/frontend/build/`

---

## 📦 Download Options

### Option 1: Download Compressed Archive (Recommended)

Two compressed files have been created for easy download:

1. **uniflow-grants-website.zip** (502 KB)
   - Location: `/app/frontend/uniflow-grants-website.zip`
   
2. **uniflow-grants-website.tar.gz** (501 KB)
   - Location: `/app/frontend/uniflow-grants-website.tar.gz`

### Option 2: Download Individual Files

If you prefer, you can download the entire `/app/frontend/build/` folder.

---

## 📥 How to Download Files from Emergent Platform

### Method 1: Using File Browser (If Available)
1. Navigate to `/app/frontend/`
2. Find `uniflow-grants-website.zip`
3. Right-click and select "Download"

### Method 2: Using Command Line (Generate Download Link)
Run this command to copy files to a downloadable location:
```bash
cp /app/frontend/uniflow-grants-website.zip ~/downloads/
```

### Method 3: If Platform Doesn't Support Direct Download
Contact support or use the deployment export feature if available in your Emergent interface.

---

## 🚀 Deploy to cPanel - Step by Step

### Step 1: Login to cPanel
- Go to your hosting provider's cPanel login
- Enter your credentials

### Step 2: Navigate to File Manager
- Find and click "File Manager" in cPanel
- Navigate to `public_html` (or your domain's root folder)

### Step 3: Clear Existing Files (If Any)
- Select all existing files in `public_html`
- Click "Delete" (only if replacing an old site)

### Step 4: Upload Your Website
- Click "Upload" button in File Manager
- Select `uniflow-grants-website.zip` from your computer
- Wait for upload to complete

### Step 5: Extract Files
- Go back to File Manager
- Find `uniflow-grants-website.zip`
- Right-click and select "Extract"
- Files will be extracted to a `build` folder

### Step 6: Move Files to Root
After extraction, you'll have a `build` folder. Move its contents to `public_html`:
- Open the `build` folder
- Select all files (index.html, static folder, etc.)
- Click "Move" 
- Move to `/public_html/` (one level up)

### Step 7: Verify .htaccess File Exists ⚠️ CRITICAL

**This step is ESSENTIAL for direct URL access to work!**

After moving files, verify `.htaccess` file is in `public_html`:

1. Click "Settings" in top right of File Manager
2. Check "Show Hidden Files (dotfiles)"
3. Click "Save"
4. Look for `.htaccess` file in `public_html` (same folder as index.html)

**If .htaccess is missing:**
The file should have been included in the build. If not, create it manually:

- Click "New File" in File Manager
- Name it exactly: `.htaccess` (with the dot at start)
- Right-click and "Edit"
- Paste this content:

```apache
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-l
  RewriteRule . /index.html [L]
</IfModule>

Options -Indexes
ErrorDocument 404 /index.html
ErrorDocument 403 /index.html
ErrorDocument 500 /index.html
```

- Save the file
- Set permissions to 644

**Without .htaccess, direct URLs like `/verification` will NOT work!**

See `/app/FIXING_CPANEL_ROUTING.md` for detailed troubleshooting.

### Step 8: Set Permissions (If Needed)
- Right-click on files/folders
- Select "Change Permissions"
- Set folders to 755
- Set files to 644

### Step 9: Test Your Website
Visit your domain: `https://yourdomain.com`

Test these URLs:
- Homepage: `https://yourdomain.com/`
- About: `https://yourdomain.com/about`
- Check Eligibility: `https://yourdomain.com/check-eligibility`
- Contact Support: `https://yourdomain.com/contact-support`
- Login: `https://yourdomain.com/login`
- Hidden Signup: `https://yourdomain.com/signup`
- Hidden Verification: `https://yourdomain.com/verification`

---

## 📋 Final File Structure in cPanel

Your `public_html` should look like this:

```
public_html/
├── .htaccess
├── index.html
├── manifest.json
├── robots.txt
├── favicon.ico
├── asset-manifest.json
└── static/
    ├── css/
    │   ├── main.d68ded3e.css
    │   └── main.d68ded3e.css.map
    ├── js/
    │   ├── main.e992ddda.js
    │   ├── main.e992ddda.js.LICENSE.txt
    │   └── main.e992ddda.js.map
    └── media/
```

---

## ⚠️ Important Notes

1. **Watermark Removed**: The "Made with Emergent" watermark is removed in production build
2. **Forms Working**: All 3 Cognito iframe forms are properly embedded
3. **Hidden Pages**: `/signup` and `/verification` work but have no navigation links
4. **No Backend**: This is a frontend-only build with mock authentication
5. **HTTPS Recommended**: Use HTTPS for secure form submissions

---

## 🐛 Troubleshooting

### Issue: Blank Page
**Solution**: Check if .htaccess is properly configured

### Issue: 404 on Refresh
**Solution**: Verify .htaccess file is in the root directory

### Issue: Forms Not Loading
**Solution**: Check browser console for errors. Forms require internet connection to load from Cognito

### Issue: Styles Not Loading
**Solution**: Ensure the `static` folder is uploaded correctly

---

## 📞 Need Help?

If you encounter any issues:
1. Check browser console (F12) for errors
2. Verify all files are uploaded
3. Ensure .htaccess is configured correctly
4. Check file permissions

---

## ✅ Quick Checklist

- [ ] Production build created
- [ ] Downloaded uniflow-grants-website.zip
- [ ] Logged into cPanel
- [ ] Uploaded and extracted files
- [ ] Moved files from build folder to public_html
- [ ] Created .htaccess file
- [ ] Tested homepage loads
- [ ] Tested navigation works
- [ ] Tested all 3 forms load correctly
- [ ] Verified hidden pages (/signup, /verification) work

---

**Your website is ready to go live! 🎉**
