Manual Rewrite

729
.
CyberGhostNet Group
Manual Rewrite URL Forum V 1.2.2

First Open your index forum

Find:
$tree[] = '<a href="index.php?id=' . $parent . '">' . $res['text'] . '</a>';

Change to:
$tree[] = '<a href="'.$config['homeurl'].'/forum/' . $tools->Rewrite($res['text']) . '_' . $parent . '.html">' . $res['text'] . '</a>';


Find:
echo '<a href="?id=' . $res['id'] . '">' . $res['text'] . '</a>';

Change to:
echo '<a href="'.$config['homeurl'].'/forum/' . $tools->Rewrite($res['text']) . '_' . $res['id'] . '.html">' . $res['text'] . '</a>';


Find:
echo '<a href="index.php?id=' . $res['id'] . '">' . (empty($res['text']) ? '-----' : $res['text']) . '</a> [' . $colmes . ']';

Change to:
echo '<a href="'.$config['homeurl'].'/forum/' . $tools->Rewrite($res['text']) . '_' . $res['id'] . '.html">' . (empty($res['text']) ? '-----' : $res['text']) . '</a> [' . $colmes . ']';


Find:
echo '<a href="index.php?id=' . $res['id'] . '&amp;page=' . $cpg . '">&#160;&gt;&gt;</a>';

Change to:
echo '<a href="'.$config['homeurl'].'/forum/'.$tools->Rewrite($res['text']) . '_' . $res['id'] . '_p' . $cpg . '.html">&#160;&gt;&gt;</a>';


Find:
echo '<div class="topmenu">' . $tools->displayPagination('index.php?id=' . $id . '&amp;', $start, $total, $kmess) . '</div>';

Change to:
echo '<div class="topmenu">' . $tools->displayPagination2(''.$config['homeurl'].'/forum/'.$tools->Rewrite($type1["text"]).'_' . $id, $start, $colmes, $kmess) . '</div>';


Find:
echo '...<a href="index.php?act=post&amp;id=' . $postres['id'] . '">' . _t('Read more') . '</a>';

Change to:
echo '...<a href="'.$config['homeurl'].'/forum/'.$tools->Rewrite($type1['text']) . '_p' . $postres['id'] . '.html">' . _t('Read more') . '</a>';


Find:
echo '<a href="index.php?id=' . $res['id'] . '">' . $res['text'] . '</a> [' . $count . ']';

Change to:
echo '<a href="' . $config['homeurl'] . '/forum/' . $tools->Rewrite($res['text']) . '_' . $res['id'] . '.html">' . $res['text'] . '</a> [' . $count . ']';


Done! Save this index forum, now go to .htaccess
open and add this new line

RewriteEngine On
RewriteBase /
RewriteRule ^forum/(.*)_([0-9]+).html$ forum/index.php?id=$2 [L]
RewriteRule ^forum/(.*)_([0-9]+)_p([0-9]+).html$ forum/index.php?id=$2&page=$3 [L]
RewriteRule ^forum/(.*)_p([0-9]+).html$ forum/index.php?act=post&id=$2 [L]
RewriteRule ^forum/(.*)_([0-9]+)_s([0-9]+).html$ forum/index.php?id=$2&start=$3 [L]
RewriteRule ^forum/(.*)_([0-9]+)_clip_p([0-9]+).html$ forum/index.php?id=$2&clip&page=$3 [L]


Done! save this .htaccess
Now go to Tools.php on system/johncms/ dirctory

Download the attach and read,
copy all script on the Rewrite.txt,
put to Tools.php.
Done, Now tested your code.. enjoyed this modified for full time and free time

Regard: Gabriel
Прикрепленные файлы:
.
(\/)____o_O____(\/)
Gabriel, Can be rewritten, it can work with arrays

http://php.net/manual/en/funct ... e.php

http://php.net/manual/en/funct ... e.php
The code will be shorter and more beautiful
.
CyberGhostNet Group
# Koenig (19.05.2017 / 07:39)
Gabriel, Can be rewritten, it can work with arrays

http://php.net/manual/en/funct ... e.php

http://php.net/manual/en/funct ... e.php
The code will be shorter and more beauti
more time maybe i rewrite again.. Because need long time
Всего: 3