I have a little problem with rewriting my urls from
http://www.dylian.eu to en.dylian.eu
This is what IS working: xlanguage module installed; .htaccess rewrite of en.dylian.eu to
http://www.dylian.eu/?lang=english |
http://www.dylian.eu/?something=somethingelse[edit] & lang = english (without the spaces) (why does the textsanitizer remove the & symbol if something is put right next to it??)[/edit] smarty plugin to rewrite all url's in smarty templates to the new one where needed.
And this is what isn't working: preload file to rewrite the url of redirect header(). These are the files i use (removed all the irelevant stuff...): /domainroot/.htaccess (Working)
RewriteEngine On
rewriteCond %{REQUEST_URI} ^(.*)?
RewriteRule ^en.dylian.eu/(.*)$ www.dylian.eu/$1?=english [QSA,L]
rewriteCond %{REQUEST_URI} !^(.*)?
RewriteRule ^en.dylian.eu/(.*)$ www.dylian.eu/$1?lang=english [QSA,L]
/domainroot/www.dylian.eu/class/smarty/xoops_plugins/outputfilter.xoLangRewriteModule.php (Working / Based on the xoRewriteModule)
include_once XOOPS_ROOT_PATH . '/Frameworks/smarty/xoSmartyFunctions.php';
function smarty_outputfilter_xoLangRewriteModule( $source, &$smarty ) {
if($_GET['lang'] == "english"){
$GLOBALS['xoopsLogger']->addExtra("plugin smarty for XOOPS => xoLangRewriteModule ", "Loaded");
$newurl = str_replace("www." , "en." , XOOPS_URL);
$source = str_replace(XOOPS_URL , $newurl , $source);
}
return $source;
}
?>
/domainroot/www.dylian.eu/modules/xHacks/preloads/core.php (Not fully working)
defined('XOOPS_ROOT_PATH') or die('Restricted access');
class xHacksCorePreload extends XoopsPreloadItem
{
function eventCoreHeaderAddmeta($args) // Working
{
$GLOBALS['xoopsTpl']->load_filter('output', 'xoLangRewriteModule');
}
function eventCoreIncludeFunctionsRedirectheader($args){ // Not working
// $args[0] Contains the url variable (The URL to redirect to)
if($_GET['lang'] == "english"){
$GLOBALS['xoopsLogger']->addExtra("plugin preload for XOOPS => xoLangRewriteModule ", "Loaded");
$newurl = str_replace("www." , "en." , XOOPS_URL);
$args[0] = str_replace(XOOPS_URL , $newurl , $args[0]);
//redirect_header($args[0], $args[1], $args[2], $args[3], $args[4]);
//exit();
}
}
}
?>
As you can see i tried to fix this be just calling the function again but this caused my pages to never stop loading. Does someone know how to fix this? Greets Dylian.