Metroman Posted April 3, 2013 Share Posted April 3, 2013 Добрый вечер, уважаемые форумчане.Обновил форум с 2.3.5 до 3.4.2. В старой версии URL были такие: site.ru/topic23514.htmlВ новой версии стали: showtopic=23514Можно каким либо образом вернуть старые URL, либо как сделать доступность страниц по старым URL. Надеюсь на вашу помощь. Link to comment Share on other sites More sharing options...
Bot Posted April 3, 2013 Share Posted April 3, 2013 Обратите внимание "Board url", указанный вами в профиле, некорректен, либо недоступен на данный момент. Пожауйста, заполните его, потому что он скорее всего потребуется при диагностике вашей проблемы. Link to comment Share on other sites More sharing options...
siv1987 Posted April 3, 2013 Share Posted April 3, 2013 Включить ЧПУ и переписать его шаблон http://ipbskins.ru/forum/topic5970.html 1 Link to comment Share on other sites More sharing options...
Metroman Posted April 4, 2013 Author Share Posted April 4, 2013 @siv1987, спасибо большое. Осталось решить вопрос со страничками.Было: topic16785s2461.html (где s2461 как я понял сообщение)Сейчас: topic16785.html?page=3Такое вообще реально сделать? Link to comment Share on other sites More sharing options...
siv1987 Posted April 4, 2013 Share Posted April 4, 2013 Сейчас: topic16785.html?page=3Вы неправильно переписали шаблон.Ссылка должна выглядеть подобным образом: topic16785.html/page-3 где s2461 как я понял сообщениеs - страница. Можно или через rewrite на промежуточный скрипт, который составит правильный урл и отправит редирект браузеру, либо сделать через двойной редирект - делается редирект на topic16785.html/page__st__2461, а форум уже редирекнет на topic16785.html/page-3. Link to comment Share on other sites More sharing options...
Metroman Posted April 4, 2013 Author Share Posted April 4, 2013 То есть такой URL у страниц сделать не получится? (topic16785s2461.html) Link to comment Share on other sites More sharing options...
siv1987 Posted April 4, 2013 Share Posted April 4, 2013 Первый вариант: В htaccess после RewriteEngine On добавляем RewriteRule ^topic\d+s\d+\.html redir.php [L] В корне создаем файл redir.php со следующим содержанием <?php $perPage = 20; //число сообщений на странице $board_url = 'http://'.$_SERVER['HTTP_HOST'].'/'; if( preg_match( '/(topic\d+)s(\d+)\.html/', $_SERVER['REQUEST_URI'], $out ) ) { $topic = $out[1]; $st = $out[2]; $url = $board_url.$topic.'.html'; if( $st >= $perPage ) { $pag = intval( $st / $perPage ) + 1; $url .= '/page-'.$pag; } header( 'Location: '.$url, true, 301 ); } else { header( 'Location: '.$board_url, true, 301 ); } ?> 1 Link to comment Share on other sites More sharing options...
siv1987 Posted April 4, 2013 Share Posted April 4, 2013 Второй вариант: Делам редирект на /topic%id%.html/page__st__%st%После чего форум сам сделает редирект на новый вид /topic%id%.html/page-%page% Добавить после RewriteEngine On RewriteRule ^(topic\d+)s(\d+)\.html /$1.html/page__st__$2 [R=301,L] 1 Link to comment Share on other sites More sharing options...
siv1987 Posted April 4, 2013 Share Posted April 4, 2013 То есть такой URL у страниц сделать не получится? (topic16785s2461.html)Нет, такой формат с номером страницы не получиться. 1 Link to comment Share on other sites More sharing options...
Metroman Posted April 4, 2013 Author Share Posted April 4, 2013 @siv1987, премного Вам благодарен, сейчас буду пробовать. Link to comment Share on other sites More sharing options...
Metroman Posted April 4, 2013 Author Share Posted April 4, 2013 Сейчас: topic16785.html?page=3Вы неправильно переписали шаблон.Ссылка должна выглядеть подобным образом: topic16785.html/page-3Можете указать где я ошибся? 'showtopic' => array( 'app' => 'forums', 'allowRedirect' => 1, 'out' => array( '#showtopic=(.+?)(&|$)#i', 'topic$1.html$2' ), 'in' => array( 'regex' => "#/topic(\d+?).html#i", 'matches' => array( array( 'showtopic', '$1' ) ) ) ), Link to comment Share on other sites More sharing options...
siv1987 Posted April 4, 2013 Share Posted April 4, 2013 '#showtopic=(.+?)(&|$)#i', 'topic$1.html$2'Заменить на '#showtopic=(.+?)(\#|&|$)#i', 'topic$1.html$2' Потом обновите кеш ЧПУ в админцентре. Link to comment Share on other sites More sharing options...
Metroman Posted April 4, 2013 Author Share Posted April 4, 2013 (edited) Теперь имеем: topic754.html?page=3В поисковиках: topic754.html/page-164 Естественно с поисковиков Not Found. Буду Вам очень признателен за помощь.. Edited April 4, 2013 by Metroman Link to comment Share on other sites More sharing options...
siv1987 Posted April 4, 2013 Share Posted April 4, 2013 Вы должны иметь topic754.html/page-3 Link to comment Share on other sites More sharing options...
Metroman Posted April 4, 2013 Author Share Posted April 4, 2013 Вот я хотел бы узнать как мне такого добиться? Извиняюсь за назойливость.. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now