M
M
Maxim Voronkov2016-01-21 01:09:57
MODX
Maxim Voronkov, 2016-01-21 01:09:57

How to organize url contexts by address on modx revo?

I welcome everyone!
I would like to implement it like this:
domain name.ru/test opens a new context when opened.
Made settings for the context:
Key: demo
base_url: /test
http_host:
domain name.ru/test site_start: 387
site_url http://domain name.ru/test
Plugin for OnHandleRequest event

<?php
if ($modx->context->key == 'mgr') {return;}

elseif ($modx->event->name == 'OnHandleRequest') {
  $var = $modx->getOption('request_param_alias', null, 'q');
  $request = $_REQUEST[$var];
  
  if (strpos($request, 'test') === 0) {
    $modx->switchContext('demo');
    
    $_REQUEST[$var] = substr($request, 8);
  }
}

But the error
503 Error
Page not found
The page you requested was not found gets out.
What could be the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Voronkov, 2016-01-21
@Voolyman

Thank you. I decided myself. It was necessary to properly configure htaccess and create a folder with 3 files, and this plugin can not be used.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question