I got my grade for some time racking their brains on how to the trailing slash, the RealURL automatically adds that slash if “defaultToHTMLsuffixOnPrev” is not set
http://www.example.com/artical/ -> http://www.example.com/artical
Here we have two solution for remove the trailing slash from url.
The following solution is extremely simple and banal, does not require any manipulation of the core files – only a “value” is entered in “defaultToHTMLsuffixOnPrev”.
First Solution
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']['_DEFAULT'] = array (
'fileName' => array (
'defaultToHTMLsuffixOnPrev' => chr(0),
),
);
if some time its not workout that time you can use
'defaultToHTMLsuffixOnPrev' => chr(1),
Second Solution
function user_encodeSpURL_postProc(&$params, &$ref) {
if ($params['URL'] != '/') {
$params['URL'] = preg_replace(
'/\/($|\?|\#)/U',
'\1',
$params['URL']
);
}
}
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl'] = array (
'EncodeSpURL_postProc' => array ( 'user_encodeSpURL_postProc'),
'_DEFAULT' => Array (
'Init' => array (
// [...]
'AppendMissingSlash' => 'ifNotFile'
)
// [...]
)
);
URL will look like after applying above script :
www.example.com/artical
Second method may be not work for old version of realurl. so better we use first method
If you need trailing slash from url then simply use 0 in “defaultToHTMLsuffixOnPrev”
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']['_DEFAULT'] = array (
'fileName' => array (
'defaultToHTMLsuffixOnPrev' => 0,
),
);
URL will look like after appling above script :
www.example.com/artical/
If you need trailing with .html from url then simply use 1 in “defaultToHTMLsuffixOnPrev”
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']['_DEFAULT'] = array (
'fileName' => array (
'defaultToHTMLsuffixOnPrev' => 1,
),
);
URL will look like after appling above script :
www.example.com/artical.html
I hope today i make your day ๐
If you have any queries, please do not hesitate to contact me at Jainish Senjaliya
Like this:
Like Loading...