Answer the question
In order to leave comments, you need to log in
How to change request_uri in Bitrix?
You need to implement SEO URLs.
I used to just replace the $_SERVER['REQUEST_URI'] variable in init.php, now it doesn't work. How to make a substitution in d7?
update.
All links that I want to change are made by the smart filter. Which removes all get parameters i.e. urlrewrite.php just can't be substituted. Is it really necessary to rewrite the smart filter...
Answer the question
In order to leave comments, you need to log in
As xzdshr
already wrote , this cannot be done, but let's figure out where it is located in d7.
First, let's find out how in general you can get a URI in d7:
use Bitrix\Main\Application;
use Bitrix\Main\Web\Uri;
$request = Application::getInstance()->getContext()->getRequest();
$requestUri= $request->getRequestUri();
// HttpRequest::getRequestUri()
// /bitrix/modules/main/lib/httprequest.php:226
public function getRequestUri()
{
return $this->server->getRequestUri();
}
Dictionary
, where we will be interested in the offsetSet method:/**
* Offset to set
*/
public function offsetSet($offset, $value)
{
if($offset === null)
{
$this->values[] = $value;
}
else
{
$this->values[$offset] = $value;
}
}
<?
use Bitrix\Main\Application;
use Bitrix\Main\Web\Uri;
$request = Application::getInstance()->getContext()->getRequest();
$request->offsetSet("REQUEST_URI", 'abrakadabra.php');
[Bitrix\Main\NotSupportedException]
Can not set readonly value (150)
/home/bitrix/www/bitrix/modules/main/lib/type/parameterdictionary.php:53
#0: Bitrix\Main\Type\ParameterDictionary->offsetSet(string, string)
/**
* Offset to set
*/
public function offsetSet($offset, $value)
{
throw new NotSupportedException("Can not set readonly value");
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question