Calin Onaca
Calin Onaca

Reputation: 15

my routes dont work so i cant acces a product page

I got a new obstacle. I did make a route for a specific "Product" page and dont work.

Here's my routes code

$app->get('/products{slug}',['Cart\Controllers\ProductController','get'])->setName('product.get');

and my .htaccess code is

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]

And when I access the page " localhost/cart/products/am1" it gets me Page Not Found

Upvotes: 0

Views: 30

Answers (1)

MuhammadGad
MuhammadGad

Reputation: 36

you can use this code to show single product

$app->get('/products/{slug}', "ProductController@getSingleProduct");

take cake there is "/" before parameter slug

Upvotes: 1

Related Questions