##### Setting Up Your Domain for DeltaPOS

###### 1. Understanding Document Root

The Document Root is the directory on your web server where your website's files are stored and served from. For Laravel applications like DeltaPOS, you need to point your domain's Document Root to the `/public` directory of your installation.

###### 2. Domain Setup Options

###### A. Main Domain Setup

If you're using a main domain (e.g., `yourdomain.com`):

- Upload DeltaPOS files to your hosting directory
- Navigate to your hosting control panel
- Locate domain settings or Document Root configuration
- Add `/public` to your existing Document Root path
- Example: If your Document Root is `/home/username/public_html`, change it to `/home/username/public_html/public`

###### B. Subdomain Setup

For a subdomain (e.g., `pos.yourdomain.com`):

- Create a new subdomain in your hosting control panel
- Upload DeltaPOS files to the subdomain directory
- Set the Document Root to the `/public` folder within your installation directory
- Example: `/home/username/subdomains/pos/public`

###### 3. Alternative Setup for Restricted Hosting (e.g., Hostinger)

Some hosting providers (like Hostinger) may not allow custom web root directory settings through their control panel. Here's an alternative solution to redirect all requests to the /public directory.

###### Step-by-Step Guide

1. Create a new .htaccess file

   Place this file in the root of your project, outside the public folder (e.g., `source_code/.htaccess`)

2. Add the following code:

       <IfModule mod_rewrite.c>
           RewriteEngine On
           RewriteRule ^(.*)$ public/$1 [L]
       </IfModule>

###### Result

After implementing this solution, you can access your application through:

- Main domain: `https://example.com` (instead of `https://example.com/public`)
- Subdomain: `https://pos.example.com`

###### Example Configuration

###### 4. Example Configuration

In this example:

- Main domain: `creatantech.com`
- Subdomain: `medmo.creatantech.com`
- Document Root points to: `/public` directory of the Laravel application

###### 5. Directory Permissions

After setting up your domain, you need to set proper permissions (775) for certain directories to ensure the application works correctly:

Directory | Required Permission | Command | Description
--- | --- | --- | ---
`bootstrap/cache` | 775 | `chmod -R 775 bootstrap/cache` | Stores framework bootstrap cache files
`storage/framework` | 775 | `chmod -R 775 storage/framework` | Contains framework generated files and caches
`storage/logs` | 775 | `chmod -R 775 storage/logs` | Stores application log files

###### Setting Permissions via SSH

You can set all required permissions at once using these commands:

    chmod -R 775 bootstrap/cache
    chmod -R 775 storage/framework
    chmod -R 775 storage/logs

###### Important Permission Notes:

- These directories must be writable by your web server
- The recommended permission is 775 for these directories
- For better security, ensure these directories are not publicly accessible
- Some hosting panels provide GUI options to set permissions

###### 6. Important Notes

- Local Development: When running on localhost, you don't need to add `/public` to the URL
- File Permissions: Ensure proper read/write permissions are set for storage and cache directories
- SSL Certificate: We recommend installing an SSL certificate for secure HTTPS access
- Backup: Always backup your files before making Document Root changes

###### 7. Common Issues and Solutions

Issue | Solution
--- | ---
404 Page Not Found | Verify Document Root points to the correct /public directory
Permission Denied | Check and set proper file permissions (typically 755 for directories)
Assets Not Loading | Ensure .htaccess file is present in the public directory and mod_rewrite is enabled

Need Help? If you encounter any issues during domain setup, please contact our support team with your hosting control panel screenshots for assistance.