Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More explanation #175

Open
mitmelon opened this issue Oct 24, 2020 · 1 comment
Open

More explanation #175

mitmelon opened this issue Oct 24, 2020 · 1 comment
Labels

Comments

@mitmelon
Copy link

mitmelon commented Oct 24, 2020

use Aura\Router\RouterContainer;
/**
	 * Database Connector
	 * 
	 * @link https://www.watermelon.lucychats.com/docs for Programming Tutorials
	 * @author lucychats <[email protected]>
	 */
    include __DIR__ . '/autoload.php';

    $routerContainer = new RouterContainer();
    $map = $routerContainer->getMap();

    $map->get('blog.read', '/index/{id}', function ($request) {
        $id = (int) $request->getAttribute('id');
        $response = new \Zend\Diactoros\Response();
        $response->getBody()->write("You asked for blog entry {$id}.");
        echo $response;
    });

I have the code on my index.php page with .htaccess

RewriteEngine on

Options All -Indexes

RewriteRule ^$ index.php [QSA]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,L]

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*?)/?$ $1.php [NC,L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html [NC,L]

I tried outputing the id arugument of the route but nothing is showing...

Am a newbie in working with route please give me more explanations on how to do this... Thanks.

@harikt
Copy link
Member

harikt commented Feb 2, 2022

I am not using apache. I am using nginx. But anything that most of the php projects follow should work. FYI you can look at the docs from Symfony regarding the server configuration for the current time. https://symfony.com/doc/current/setup/web_server_configuration.html#apache-with-php-fpm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants