Joomla bypass system

I would like a piece of code that allowed me to intercept the specified URL, and then, depending on the parameter, serve a specific page.

The goal would be that regardless of whether the URL of the last part of the URL was β€œ/ blah”, the page I would like to display.

ex 1: http://website/index.php/blah/ ex 2: http://website/index.php/blogcategory/articlex/blah/ ex 3: http://website/index.php/blogcategory/article5/blah/ 

Show all the same articles.

Thanks,

Mat

0
source share
1 answer

You need a plugin that runs 'onAfterInitialise'. Take a look:

http://docs.joomla.org/Plugin/Events/System#onAfterInitialise

The code you need for your function will be something like (not verified):

 /** * Do something onAfterInitialise */ function onAfterInitialise() { // check for occurrence of string in url $findme = 'blah'; $myuri = JRequest::getURI(); $tocheck = strpos($myuri, $findme); if ($tocheck === true) { $app = JFactory::getApplication(); $app->redirect('/anywhereyouwant'); } } 
0
source

Source: https://habr.com/ru/post/923001/


All Articles