# Deploy to ai.kagazseva.com (cPanel — Simple Flat Structure)

This version has **everything in one folder** — no `public/` subfolder, no
Document Root changes needed. Just extract and it works.

---

## Step 1: Subdomain (you already did this)

`ai.kagazseva.com` subdomain created, document root noted (e.g.
`/home/username/ai_kagazseva`) — **no need to change it further**, leave it
as cPanel created it.

## Step 2 & 3: Database + schema import (you already did this)

Database created, `database/schema.sql` imported via phpMyAdmin. ✅

## Step 4: Admin password (you already did this)

Set via bcrypt hash + SQL UPDATE query. ✅

## Step 5: Upload files

1. cPanel → **File Manager** → go into your subdomain's document root
   (`ai_kagazseva`, or whatever it's called)
2. Upload `app-generator.zip`
3. Right-click → **Extract**
4. Move everything from inside the extracted `app-generator` folder **up one
   level** into the document root directly, then delete the empty
   `app-generator` folder and the zip.

You should end up with, directly inside the document root:
```
admin/
application/
category/
user/
api/
partials/
includes/
config/
database/
vendor/
assets/
index.php
about.php
contact.php
... (all other .php files directly here)
.htaccess
```

**That's it — no Document Root change, no `public/` folder to worry about.**

## Step 6: Configure database credentials

Open `config/database.php` in File Manager's code editor, set your real values:

```php
$DB_HOST = getEnvOrDefault('DB_HOST', 'localhost');
$DB_NAME = getEnvOrDefault('DB_NAME', 'youruser_kagazseva');
$DB_USER = getEnvOrDefault('DB_USER', 'youruser_dbuser');
$DB_PASS = getEnvOrDefault('DB_PASS', 'your_actual_password');
```

## Step 7: Test it

1. Visit `https://ai.kagazseva.com/` — should show the styled landing page
2. Visit `https://ai.kagazseva.com/admin/login.php` — log in with your admin
   email/password
3. Add a category and a template, then test the public flow: fill a form,
   check the live preview, download the PDF

## Security note (already handled for you)

Folders like `includes/`, `config/`, `database/`, `vendor/` contain PHP code
and credentials, not pages meant to be visited directly. The included
`.htaccess` already blocks direct browser access to those folders — you don't
need to do anything extra, just make sure `.htaccess` was actually uploaded
(enable "Show Hidden Files" in File Manager settings if you don't see it).

## Common issues

- **CSS not loading / plain unstyled page**: View page source, check the
  `<link>` tag's href — should be `/assets/css/site.css`. If the page looks
  broken, the `.htaccess` might not have uploaded, or `mod_rewrite` isn't
  enabled (rare on cPanel, but check with your host if this happens).
- **500 error**: cPanel → **MultiPHP Manager** — set this subdomain to PHP
  8.2 or higher.
- **Database connection error**: recheck Step 6 values.
- **404 on `/category/...`**: confirm `.htaccess` uploaded correctly (it's a
  hidden file — enable "Show Hidden Files" in File Manager to verify).
