pragmaMx Support Forum

pragmaMx => Türkçe (Turkish) => Language Specific Support => SMF-pragmaMx Köprüsü => Thema gestartet von: ozeraksu in 22 Juli 2008, 10:03:32

Titel: mod_rewrite SMF PragmaMx
Beitrag von: ozeraksu in 22 Juli 2008, 10:03:32
Merhaba

Burada size Smf mod_rewrite ayarlarını anlatacagim.Bu degişiklik sayesinde:

http://www.sizinsiteniz.com/Forum-board-249.html
http://www.sizinsiteniz.com/Forum-top-mod_rewrite-SMF-PragmaMx-249.html şeklide gözükecek

1.Öncelikle modrewrite özellikgini http://{domain}/admin.php?op=Configure kısmından aktif ediyoruz.

2.Ana dizinde bulunan .htaccess dosyasını açıyoruz ve ekliyoruz.

##Rules fürs Forum
RewriteRule ^(Forum)-cat-(.*)-([0-9]+).html$ modules.php?name=$1&board=$3 [L]
RewriteRule ^(Forum)-top-(.*)-([0-9]+).html$ modules.php?name=$1&topic=$3 [L]
RewriteRule ^(Forum)-top-(.*)-([0-9]+)-start-(.*).html$ modules.php?name=$1&topic=$3.$4[L]

Hali hazırda varsa eklemeye gerek yok.

3. modules/Forum/mx_functions.php dizinindeki mx_functions.php dosyasını açıyoruz.
ve buluyoruz.

if (isset($dynachanges)) {
            $smfContent = str_replace(array_keys($dynachanges), array_values($dynachanges), $smfContent);
        }
    }


Altına ekliyoruz.

// Start mod_rewrite SMF 1.1.5
// Umlaute
$umlaute = array(
"ä",
"ü",
"ü",
"ö",
"Ä",
"Ü",
"Ö",
"ß",
"ß",
"Ü",
"ß",
"ä",
"&",
"""
);

$ersetzung = array(
"ae",
"ue",
"ue",
"oe",
"ae",
"ue",
"oe",
"ss",
"ss",
"Ue",
"ss",
"ae",
"und",
"-"
);

$html = array("Forum-board-", ".html");
$html_ersetzung = array("", "");
$html_t = array("Forum-topic-", ".html");
$html_ersetzung_t = array("", "");

//Forum Kategorien
preg_match_all('#Forum-board-(\d*).html#', $smfContent, $forum, PREG_SET_ORDER);
                        foreach ($forum as $forum1){

                        $forum2[0] = str_replace($html, $html_ersetzung, "".$forum1[0]."");
                        $abfrage = "SELECT name, ID_BOARD FROM mx_smf_boards WHERE ID_BOARD = '$forum2[0]'";
                           $ergebnis = mysql_query($abfrage);
                                   while($row = mysql_fetch_array($ergebnis))
                              {       
                                               
                                                $titel_forum_rewrite = $row["name"];
                                                $titel_forum_rewrite = str_replace($umlaute, $ersetzung, $titel_forum_rewrite);
                                                $titel_forum_rewrite = preg_replace('#\W#', "-", $titel_forum_rewrite);
                                                $titel_forum_rewrite = preg_replace('#---#', "-", $titel_forum_rewrite);
                                                $titel_forum_rewrite = preg_replace('#--#', "-", $titel_forum_rewrite);
                                                $titel_forum_fert = "Forum-cat-";
                                                $titel_forum_fert.= "$titel_forum_rewrite-";
                                                $titel_forum_fert.= $forum2[0];
                                                $titel_forum_fert.= ".html";
                                                $replace = "#".$forum1[0]."(?!\d)#";
                                                $smfContent = preg_replace($replace, $titel_forum_fert, $smfContent);
                                                                        }
               
                                        }
preg_match_all('#Forum-topic-(\d*).html#', $smfContent, $forum_t, PREG_SET_ORDER);
                        foreach ($forum_t as $forum1_t){

                        $forum2_t[0] = str_replace($html_t, $html_ersetzung_t, "".$forum1_t[0]."");         
                        $abfrage = "SELECT subject, ID_TOPIC FROM mx_smf_messages WHERE ID_TOPIC = '$forum2_t[0]'";
                           $ergebnis = mysql_query($abfrage);
                                   while($row = mysql_fetch_array($ergebnis))
                              {       
                                               
                                                $titel_forum_rewrite_t = $row["subject"];
                                                $titel_forum_rewrite_t = str_replace($umlaute, $ersetzung, $titel_forum_rewrite_t);
                                                $titel_forum_rewrite_t = preg_replace('#\W#', "-", $titel_forum_rewrite_t);
                                                $titel_forum_rewrite_t = preg_replace('#---#', "-", $titel_forum_rewrite_t);
                                                $titel_forum_rewrite_t = preg_replace('#--#', "-", $titel_forum_rewrite_t);
                                                $titel_forum_fert_t = "Forum-top-";
                                                $titel_forum_fert_t.= "$titel_forum_rewrite_t-";
                                                $titel_forum_fert_t.= $forum2_t[0];
                                                $titel_forum_fert_t.= ".html";
                                                $replace = "#".$forum1_t[0]."(?!\d)#";
                                                $smfContent = preg_replace($replace, $titel_forum_fert_t, $smfContent);

        }
    }
preg_match_all('#Forum-topic-(\d*)-start-msg(\d*).html#', $smfContent, $forum_to, PREG_SET_ORDER);
                        foreach ($forum_to as $forum1_to){
$ersetz_for_new = "-start-msg$forum1_to[2].html";
$html_to = array("Forum-topic-", $ersetz_for_new);
$html_ersetzung_to = array("", "");

$forum2_to[0] = str_replace($html_to, $html_ersetzung_to, "".$forum1_to[0]."");

                        $abfrage = "SELECT subject, ID_TOPIC FROM mx_smf_messages WHERE ID_TOPIC = '$forum2_to[0]'";
                           $ergebnis = mysql_query($abfrage);
                                   while($row = mysql_fetch_array($ergebnis))
                              {       
                                               
                                                $titel_forum_rewrite_to = $row["subject"];
                                                $titel_forum_rewrite_to = str_replace($umlaute, $ersetzung, $titel_forum_rewrite_to);
                                                $titel_forum_rewrite_to = preg_replace('#\W#', "-", $titel_forum_rewrite_to);
                                                $titel_forum_rewrite_to = preg_replace('#---#', "-", $titel_forum_rewrite_to);
                                                $titel_forum_rewrite_to = preg_replace('#--#', "-", $titel_forum_rewrite_to);
                                                $titel_forum_fert_to = "Forum-top-";
                                                $titel_forum_fert_to.= "$titel_forum_rewrite_to-";
                                                $titel_forum_fert_to.= $forum2_to[0];
                                                $titel_forum_fert_to.= ".html";
                                                $replace = "#".$forum1_to[0]."(?!\d)#";
                                                $smfContent = preg_replace($replace, $titel_forum_fert_to, $smfContent);

        }
    }

preg_match_all('#Forum-topic-(\d*)-start-msg(\d*)-boardseen.html#', $smfContent, $forum_to1, PREG_SET_ORDER);
                        foreach ($forum_to1 as $forum1_to1){
$ersetz_for_new1 = "-start-msg$forum1_to1[1]-boardseen.html";

$html_to1 = array("Forum-topic-", $ersetz_for_new1);
$html_ersetzung_to1 = array("", "");
                       
                        $forum2_to1[0] = str_replace($html_to1, $html_ersetzung_to1, "".$forum1_to1[0]."");         
                        $abfrage = "SELECT subject, ID_TOPIC FROM mx_smf_messages WHERE ID_TOPIC = '$forum2_to1[0]'";
                           $ergebnis = mysql_query($abfrage);
                                   while($row = mysql_fetch_array($ergebnis))
                              {       
                                               
                                                $titel_forum_rewrite_to1 = $row["subject"];
                                                $titel_forum_rewrite_to1 = str_replace($umlaute, $ersetzung, $titel_forum_rewrite_to1);
                                                $titel_forum_rewrite_to1 = preg_replace('#\W#', "-", $titel_forum_rewrite_to1);
                                                $titel_forum_rewrite_to1 = preg_replace('#---#', "-", $titel_forum_rewrite_to1);
                                                $titel_forum_rewrite_to1 = preg_replace('#--#', "-", $titel_forum_rewrite_to1);
                                                $titel_forum_fert_to1 = "Forum-top-";
                                                $titel_forum_fert_to1.= "$titel_forum_rewrite_to1-";
                                                $titel_forum_fert_to1.= $forum2_to1[0];                                         
                                                $replace = "#".$forum1_to1[0]."(?!\d)#";
                                                $smfContent = preg_replace($replace, $titel_forum_fert_to1, $smfContent);

        }
    }
preg_match_all('#Forum-topic-(\d*)-start-new.html#', $smfContent, $forum_to_new, PREG_SET_ORDER);
                        foreach ($forum_to_new as $forum1_to_new){


$html_to_new = array("Forum-topic-", "-start-new.html");
$html_ersetzung_to_new = array("", "");
                       
$forum2_to_new[0] = str_replace($html_to_new, $html_ersetzung_to_new, "".$forum1_to_new[0]."");     

                        $abfrage = "SELECT subject, ID_TOPIC FROM mx_smf_messages WHERE ID_TOPIC = '$forum2_to_new[0]'";
                           $ergebnis = mysql_query($abfrage);
                                   while($row = mysql_fetch_array($ergebnis))
                              {       
                                               
                                                $titel_forum_rewrite_to_new = $row["subject"];
                                                $titel_forum_rewrite_to_new = str_replace($umlaute, $ersetzung, $titel_forum_rewrite_to_new);
                                                $titel_forum_rewrite_to_new = preg_replace('#\W#', "-", $titel_forum_rewrite_to_new);
                                                $titel_forum_rewrite_to_new = preg_replace('#---#', "-", $titel_forum_rewrite_to_new);
                                                $titel_forum_rewrite_to_new = preg_replace('#--#', "-", $titel_forum_rewrite_to_new);
                                                $titel_forum_fert_to_new = "Forum-top-";
                                                $titel_forum_fert_to_new.= "$titel_forum_rewrite_to_new-";
                                                $titel_forum_fert_to_new.= $forum2_to_new[0];   
                                                $titel_forum_fert_to_new.= ".html";                                   
                                                $replace = "#".$forum1_to_new[0]."(?!\d)#";
                                                $smfContent = preg_replace($replace, $titel_forum_fert_to_new, $smfContent);

        }
    }
// Ende mod_rewrite SMF 1.1.5


mx_ ile başlayan prefix degerlerini kendinize göre uyarlamayı unutmayın örnek mx12345_ gibi

pragmamx 0.1.10 / SMF 1.1.5 /  pragmaMx SMF Bridge 1.1.5.1 üzerinde uygulanmıştır..



Edit by Sitki: Resim/Bild çıkarıldı/entfernt.
Titel: Re: mod_rewrite SMF PragmaMx
Beitrag von: pragmamx_master in 22 Juli 2008, 23:40:08
Anlatimin için tesekkurler  :thumbup: SMF Bridge 1.4.1 'de denedim ancak ancak ilk ekrenen seo gibi hiç farkeden birsey yok ve herhangi bir hata vermiyor. Yarin vakit olursa, 1.1.5.1'te deniyecegim  :smile: Tekrar tesekkur ederim.
Titel: Re: mod_rewrite SMF PragmaMx
Beitrag von: yorum in 26 Juli 2008, 13:15:14
anlatim icin tesekürler, ama mod_rewrite  ne ise yarar yeni baslayanlar icin bir aciklama yapabilirmisiniz?
Titel: Re: mod_rewrite SMF PragmaMx
Beitrag von: ozeraksu in 26 Juli 2008, 13:32:34
Apache'nin mod_rewrite modülü ile .htaccess dosyasına yazarak bu yapılıyor. Bu marifete ReWrite Engine'de deniliyor. Bundan sonrası için script'ler sadece gelen parametreye göre neyi göstereceğini belirliyor. Örn;

haber.php(asp)?yil=2007&ay=03&gun=09&konu=merhaba

requestini, rewrite engine ile

/haberler/2007/03/09/merhaba.html

şeklinde yorumluyor.

Rewrite engine (http://en.wikipedia.org/wiki/Rewrite_engine)
Titel: Re: mod_rewrite SMF PragmaMx
Beitrag von: BAMTELI12 in 20 November 2008, 11:04:01
anlatimi aynen uyguladim lakin.... Forum-topic-5809.html olarak gösteriyor.
vede pragmamx.org forumundada ayni gösteriyor

konu basliklarinin adres yerine nasil ala biliriz?? sizin sitede uygulanilmis.
Tesekkürler
Titel: Re: mod_rewrite SMF PragmaMx
Beitrag von: ozeraksu in 20 November 2008, 11:30:55
Merhaba

Eger aşagıda anlatılanları yaptıysanız çalışmaması gibi bir sorun olmaması lazim mx_smf_messages adındaki Prefixleri degiştirmeyi unutmayın.

Ekteki dosyayı sitenizin /modules/Forum dizine atınız.


Selam
Titel: Re: mod_rewrite SMF PragmaMx
Beitrag von: BAMTELI12 in 20 November 2008, 11:36:00
Zitat von: ozeraksu in 20 November 2008, 11:30:55
Merhaba

Eger aşagıda anlatılanları yaptıysanız çalışmaması gibi bir sorun olmaması lazim mx_smf_messages adındaki Prefixleri degiştirmeyi unutmayın.

Ekteki dosyayı sitenizin /modules/Forum dizine atınız.


Selam

aynen uygulandi sanirim sorun Köprüden bilgiler icin tesekkürler.