[TYPO3-english] Re: Disable RealURL for specific URL
Olivier Seubert
olizzs at yahoo.de
Sun Mar 22 23:41:22 CET 2015
I found the following solution: Setting a RealUrl hook to prevent RealURL from trying to parse the URL:
In your extension's ext_localconf.php you set e.g.:
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']['decodeSpURL_preProc'][] = 'EXT:yourextension/Classes/Hooks/RealUrlHook.php:\\YourVendor\\YourExtension\\Hooks\\RealUrlHook->decodeSpURL_preProc';
And in yourextension/Classes/Hooks/RealUrlHook.php:
<?php
namespace YourVendor\YourExtension\Hooks;
/**
* Hook functions for RealURL.
*
* @package yourextension
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 or later
*/
class RealUrlHook {
/**
* Hook function to prevent RealURL from further parsing,
* when parameter is set via HTTP-request. Instead forward to
* root page.
*
* @param array $params
* @param tx_realurl $ref
*/
function decodeSpURL_preProc(&$params, &$ref) {
// check if get parameter is set
if (($_SERVER !== null) &&
array_key_exists('QUERY_STRING', $_SERVER) &&
preg_match('/(?:^|.*&)tx_yourextension\\[bypassrealurl\\]=(?:1|true).*/is', $_SERVER['QUERY_STRING'])) {
// if yes, forward to root page
$params['URL'] = "/";
}
}
}
Hope this helps somebody.
More information about the TYPO3-english
mailing list