RewriteCond %{HTTP_HOST} ^www\.oldsite\.com$ [NC]
RewriteRule ^(.*)$ http://newsite.com/$1 [L,R=301]
RewriteCond %{HTTP_HOST} ^oldsite\.com$ [NC]
RewriteRule ^(.*)$ http://newsite.com/$1 [L,R=301]
В самое начало index.php - написано для 2.5. Я не проверяла.
$uri = preg_replace("/\?.*/i",'', $_SERVER['REQUEST_URI']);
if ((!strpos($uri, 'administrator')) && (strlen($uri)>1)) {
if (rtrim($uri,'/')!=$uri) {
header("HTTP/1.1 301 Moved Permanently");
header('Location: http://'.$_SERVER['SERVER_NAME'].str_replace($uri, rtrim($uri,'/'), $_SERVER['REQUEST_URI']));
exit();
}
}
Вставляем в index.php шаблона
// Убираем дубль index.php
if($_SERVER['REQUEST_URI'] == '/index.php') {
header("Location: /",TRUE,301);
exit();
}
Без слеша на конце
$myurl = JUri::base();
if($_SERVER['REQUEST_URI'] == '/index.php') {
header("Location: $myurl",TRUE,301);
exit();
}