Cotonti / Open Source PHP Content Management FrameworkContent Management Framework

Forums / Cotonti / General / Easy sef link system !

MecTruy
#1 2013-10-30 12:17

Why haven't Cotonti siena easy sef link system for seo ?  yes have but not easy very mixx if cotonti siena want succes , first sef link must be good.

Kurta sormuşlar senin ensen neden kalın ? diye, Kendi işimi kendim yaparımda ondan demiş...
Gökhan YILDIZ
#2 2013-10-30 15:14

Actually very easy. Just need to know what you're doing. First step http://www.cotonti.com/docs/admin/sef_urls To achieve this, need you to write own your rules.

Gökhan YILDIZ

This post was edited by Gökhan YILDIZ (2013-10-30 16:10, 5 years ago)
MecTruy
#3 2013-10-31 08:39

Mr.Gökhan for forum sef url how is setting ? can you give me example ? because i read many example but just all other pages not for forums.

Kurta sormuşlar senin ensen neden kalın ? diye, Kendi işimi kendim yaparımda ondan demiş...
Gökhan YILDIZ
#4 2013-10-31 11:33

Yes of course.

Go to Administration Panel >> Other >> URL Editor or Settings (anyone) >> add new rule

first rule

Area : forums
Parameters: m=*&q=*
Format: {$_area}/{$m}/{$q} or {$_area}/{$m}/{$q}.html

second rule

Area: forums
Parameters : m=*&s=*
Format: {$_area}/{$m}/{$s}

last rule

Area: forums
Parameters : m=*
Format: {$_area}/{$m}

Not tested but should work. Waiting for the results.

 

Gökhan YILDIZ
MecTruy
#5 2013-10-31 23:41

it's not working, i did but gave me like this url: http://www.cotontix.com/forums/posts?q=1&n=last#bottom

 

Kurta sormuşlar senin ensen neden kalın ? diye, Kendi işimi kendim yaparımda ondan demiş...
Gökhan YILDIZ
#6 2013-11-01 08:25

We try a different method

Go to Administration Panel >> Other >> URL Editor >> URL Preset select to Genoa/Seditio Compatible and save.

Open

modules/forums/inc/forums.functions.php

find:

$cot_extrafields[$db_forum_topics] = (!empty($cot_extrafields[$db_forum_topics])) ? $cot_extrafields[$db_forum_topics] : array();

add after:

/**
* Cotonti sef-link function
* Author Gökhan YILDIZ
**/
function sef_link($cot_sef_title){
    $turkish = array('ş','Ş','ı','İ','ğ','Ğ','ü','Ü','ö','Ö','ç','Ç');
    $english = array('s','s','i','i','g','g','u','u','o','o','c','c');
    $cot_sef_title = str_replace($turkish,$english,$cot_sef_title);
    $cot_sef_title = strtolower($cot_sef_title);
    $cot_sef_title = preg_replace('/&.+?;/', '-', $cot_sef_title);
    $cot_sef_title = preg_replace('/[^%a-z0-9 _-]/', '-', $cot_sef_title);
    $cot_sef_title = preg_replace('/\s+/', '-', $cot_sef_title);
    $cot_sef_title = preg_replace('|-+|', '-', $cot_sef_title);
    $cot_sef_title = str_replace("--","-",$cot_sef_title);
    $cot_sef_title = trim($cot_sef_title, '-');
    return $cot_sef_title;
} 

find:

$tmp[] = array(cot_url('forums', 'm=topics&s=' . $x), $structure['forums'][$x]['title']);

replace:

$tmp[] = array('forums/topics/' . $cat.'/', $structure['forums'][$x]['title']);

find:

$tag_prefix . 'URL' => cot_url('forums', 'm=topics&s=' . $cat),

replace:

$tag_prefix . 'URL' => 'forums/topics/' . $cat.'/',

find:

$tag_prefix . 'LASTPOST' => cot_rc_link($new_elems ? cot_url('forums', 'm=posts&q=' . $stat['fs_lt_id'] . '&n=unread', '#unread') : cot_url('forums', 'm=posts&q=' . $stat['fs_lt_id'] . '&n=last', '#bottom'), cot_cutstring($stat['fs_lt_title'], 32)),

replace:

$tag_prefix . 'LASTPOST' => cot_rc_link($new_elems ? 'forums/posts/' . $stat['fs_lt_id'] . '/unread/#unread' : 'forums/posts/' . $stat['fs_lt_id'] . '/'.sef_link($stat['fs_lt_title']).'/last/#bottom', cot_cutstring($stat['fs_lt_title'], 32)),

find:

$tag_prefix . 'LASTPOST_URL' => $new_elems ? cot_url('forums', 'm=posts&q=' . $stat['fs_lt_id'] . '&n=unread', '#unread') : cot_url('forums', 'm=posts&q=' . $stat['fs_lt_id'] . '&n=last', '#bottom'),

replace:

$tag_prefix . 'LASTPOST_URL' => $new_elems ? 'forums/posts/' . $stat['fs_lt_id'] . '/'.sef_link($stat['fs_lt_title']).'/unread/#unread' : 'forums/posts/' . $stat['fs_lt_id'] . '/'.sef_link($stat['fs_lt_title']).'/last/#bottom',

save and reload ftp.

open modules/forums/inc/forums.topics.php

find:

cot_redirect(cot_url('forums', "m=topics&s=".$s, '', true));

replace:

cot_redirect('forums/topics/".$s."/', '', true);

find:

$row['ft_url'] = cot_url('forums', "m=posts&q=".$row['ft_movedto']);

replace:

$row['ft_url'] = "forums/posts/".$row['ft_movedto']."/".sef_link($row['ft_title'])."/";

find:

$row['ft_lastposturl'] = cot_url('forums', "m=posts&q=".$row['ft_movedto']."&n=last", "#bottom");

replace:

$row['ft_lastposturl'] = "forums/posts/".$row['ft_movedto']."/".sef_link($row['ft_title'])."/last/#bottom";

find:

$row['ft_url'] = cot_url('forums', "m=posts&q=".$row['ft_id']);

replace:

$row['ft_url'] = "forums/posts/".$row['ft_id']."/".sef_link($row['ft_title'])."/";

find:

$row['ft_lastposturl'] = ($usr['id'] > 0 && $row['ft_updated'] > $usr['lastvisit']) ? cot_url('forums', "m=posts&q=".$row['ft_id']."&n=unread", "#unread") : cot_url('forums', "m=posts&q=".$row['ft_id']."&n=last", "#bottom");

replace:

$row['ft_lastposturl'] = ($usr['id'] > 0 && $row['ft_updated'] > $usr['lastvisit']) ? "forums/posts/".$row['ft_id']."/unread/#unread" : "forums/posts/".$row['ft_id']."/last/#bottom";

find:

$jumpbox[cot_url('forums', "m=topics&s=".$key, '', true)] = $val['tpath'];

replace:

$jumpbox["forums/topics/".$key."/, '', true"] = $val['tpath'];

save and reload ftp

.htaccess (upload your root directory)

Options -Indexes
RewriteEngine On
RewriteBase "/"
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
Options +FollowSymlinks 
RewriteEngine On 
RewriteRule ^forums/([^/-]+)/$ forums.php?m=$1& [L,NC]
RewriteRule ^forums/([^/-]+)/([^/-]+)/$ forums.php?m=$1&s=$2& [L,NC]
RewriteRule ^forums/posts/([a-zA-Z0-9-_]+)/$ forums.php?m=posts&q=$1& [L,NC]
RewriteRule ^forums/posts/([a-zA-Z0-9-_]+)/([a-zA-Z0-9-_]+)/$ forums.php?m=posts&q=$1&$2& [L,NC]
RewriteRule ^forums/posts/([a-zA-Z0-9-_]+)/([a-zA-Z0-9-_]+)/([^/-]+)/$ forums.php?m=posts&q=$1&=$2&n=$3& [L,NC]

Try again now

Gökhan YILDIZ

This post was edited by Gökhan YILDIZ (2013-11-01 12:47, 5 years ago)
MecTruy
#7 2013-11-01 14:43

...

Kurta sormuşlar senin ensen neden kalın ? diye, Kendi işimi kendim yaparımda ondan demiş...

This post was edited by MecTruy (2013-11-04 13:44, 5 years ago)