i ve tried some methods to route my url
rootdirectory/src/Simplex/app.php
require __DIR__.'/../vendor/autoload.php';
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
$routes = new RouteCollection();
$routes->add('ip',
new Route('/ip',
[
'IPAddress' => "52.77.50.64",
'_controller' => 'Controller\Controller::getIPResponse',
]
)
);
$routes->add('home',
new Route('/',
[
'IPAddress' => "52.77.50.64",
'_controller' => 'Controller\Controller::getIPResponse',
]
)
);
and
rootdirectory/front.php
require __DIR__.'/vendor/autoload.php';
use Symfony\Component\HttpFoundation\Request;
$globals = (Request::createFromGlobals())->getPathInfo();
$request = Request::create($globals);
$routes = include __DIR__ . '/src/app.php';
$container = include __DIR__ . '/src/container.php';
$response = $container->get('framework')->handle($request);
$response->send();
when i try to access myDomain.com/front.php/ip it works but when i try to use myDomain.com/ip it doesnt work.
I also worked on my .conf file and it pointing to my front controller. ie if i go to myDomain.com/ it works .
I also checked symfony routing doc but i think they didnt give the solution for this.
I havent used .htaccess file
The solution lies in xyz.conf file . i used fallbackresources /front.php and it worked fine. Similar to the code below
<VirtualHost *:80>
ServerName foo.example.com
DocumentRoot /var/www/html
DirectoryIndex index.php
FallbackResource /index.php
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.