hello i have issue about my php and vue js project. when i have this .htaccess file configurations :
RewriteEngine On
# Deliver the folder or file directly if it exists on the server
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
# Redirect every request to index.php
RewriteRule ^ index.php [L]
database connection is ok also not cors error at all but when i reload /add-product page it gives me 404 error when i searched this issue
i fixed it with this .htaccess file configurations :
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . /index.html [L]
</IfModule>
page reloading fixed but now i am getting cors error how can i fix it what can be issue?
namespace App;
error_reporting(E_ALL);
ini_set('display_errors', 1); // Should be set to 0 in production
use App\Controllers\ProductController;
use App\Models\Products;
use App\Utils\Headers;
use Bramus\Router\Router;
use Dotenv\Dotenv;
class App
{
private static function setRoutes(): void
{
$router = new Router();
$productModel = new Products();
$productController = new ProductController($productModel);
$router->get('/products', [$productController, 'getProducts']);
$router->post('/create-product', [$productController, 'createProduct']);
$router->post('/mass-delete', [$productController, 'deleteProducts']);
$router->run();
}
private static function loadEnvVariables()
{
$dotenv = Dotenv::createImmutable(dirname(DIR));
$dotenv->safeLoad();
}
public static function run()
{
Headers::set();
self::loadEnvVariables();
self::setRoutes();
}
}
and structure on cpanel /public_html/.well-known
/public_html/app
/public_html/assets
/public_html/vendor
/public_html/.htaccess
/public_html/composer.json
/public_html/composer.lock
/public_html/favicon.ico
/public_html/index.html
/public_html/index.php; /public_html/app/Controllers
/public_html/app/Database
/public_html/app/Models
/public_html/app/Traits
/public_html/app/Utils
/public_html/app/App.php
RewriteEngine On
# Deliver the folder or file directly if it exists on the server
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
# Redirect every request to index.php
RewriteRule ^ index.php [L]
database connection is ok also not cors error at all but when i reload /add-product page it gives me 404 error when i searched this issue
i fixed it with this .htaccess file configurations :
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . /index.html [L]
</IfModule>
page reloading fixed but now i am getting cors error how can i fix it what can be issue?
namespace App;
error_reporting(E_ALL);
ini_set('display_errors', 1); // Should be set to 0 in production
use App\Controllers\ProductController;
use App\Models\Products;
use App\Utils\Headers;
use Bramus\Router\Router;
use Dotenv\Dotenv;
class App
{
private static function setRoutes(): void
{
$router = new Router();
$productModel = new Products();
$productController = new ProductController($productModel);
$router->get('/products', [$productController, 'getProducts']);
$router->post('/create-product', [$productController, 'createProduct']);
$router->post('/mass-delete', [$productController, 'deleteProducts']);
$router->run();
}
private static function loadEnvVariables()
{
$dotenv = Dotenv::createImmutable(dirname(DIR));
$dotenv->safeLoad();
}
public static function run()
{
Headers::set();
self::loadEnvVariables();
self::setRoutes();
}
}
and structure on cpanel /public_html/.well-known
/public_html/app
/public_html/assets
/public_html/vendor
/public_html/.htaccess
/public_html/composer.json
/public_html/composer.lock
/public_html/favicon.ico
/public_html/index.html
/public_html/index.php; /public_html/app/Controllers
/public_html/app/Database
/public_html/app/Models
/public_html/app/Traits
/public_html/app/Utils
/public_html/app/App.php