I use CloudWays hosting for my web app. I am trying to get my index page to work. Example: www.mysite.com or www.mysite.com to point to my index or home page. I have set up the following controller after running composer require annotations
<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;
class HomeController extends AbstractController
{
/**
* @Route("/", name="main")
*/
public function index()
{
return $this->render('main/index.html.twig', ['controller_name' => 'HomeController',]);
}
}
I followed the official Symfony 4 documentation for routing which defines this example code(https://symfony.com/doc/4.1/routing.html):
// src/Controller/BlogController.php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;
class BlogController extends AbstractController
{
/**
* Matches /blog exactly
*
* @Route("/blog", name="blog_list")
*/
public function list()
{
// ...
}
}
My project structure is as follows:
/projectfolder
---- /public_html
---- /bin
/config
----/dev
framework.yaml
annotations.yaml
/public
----/assets
/css
/js
.htaccess
index.php
/src
----/Controller
----HomeController.php
Kernal.php
/templates
----/main
----index.html.twig
base.html.twig
/var
/vendor
.env
.swp
composer.json
composer.lock
symfony.lock
When I enter the url www.mysite.com I get a 403 Forbidden error.
Forbidden
You don't have permission to access this resource.
Apache/2.4.25 (Debian) Server at www.mysite.om Port 80
When I enter the url www.mysite.com/public it works and displays my site perfectly.
How can i fix this issue so my index is at www.mysite.com and not www.mysite.com/public