Jump to content

Как сделать редирект с id товара

Recommended Posts

Задача, сделать редирект с ID товара, на сам товар.

Пример URL: http://example.ru/id=100 должен перенаправлять

на http://example.ru/products/name-tovar



Где name-tovar это название товара с ID=100

Edited by bingobongo
Link to post
Share on other sites
  • 3 years later...
3 часа назад, marsell сказал:

А как можно то? Дайте решение если не жалко

в view/View.php


// Все валюты


if($product_id = $this->request->get('id')){
	$product_url = $this->products->get_product(intval($product_id));
		header('Location: /products/' . $product_url->url, true, 302);
	} else {
		header('Location: /', true, 302);


Edited by alexivchenko
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...