Oui,c'est ça l'idée, mais l'engin de réécriture c'est pas la peine de l'allumer plusieurs fois.. une ça suffit.Modibo a dit:Super sympa de ta part...
J'ai lu un peu et j'ai écrit ça !
Code:RewriteEngine on RewriteRule ^showforum-([0-9]+)\.html$ index.php?showforum=$1 [L] RewriteEngine on RewriteRule ^showtopic-([0-9]+)\.html$ index.php?showtopic=$1 [L] RewriteEngine on RewriteRule ^showuser-([0-9]+)\.html$ index.php?showuser=$1 [L].
Ca doit être nazz, mais c'est juste pour savoirsi'est bien ça le principe...
Thx et Mercià ceux qui veulent m'aider, et tous les autres aussi
Modibo a dit:Tout d'un coup ça devient un peu plus dur, surtout ce que tuas dit à la fin
Et n'oublie pas que la réécriture d'URL c'est pas de la magie Exclamation
Il faut aussi que tu fasses pointer tes liens vers showuser-... au lieu de index.php?showuser=... sinon google ne peut pas "deviner" que tu essaies de mettre en place des nouveaux liens.
if ( $ibforums->vars['ipb_img_url'] )
{
$ibforums->skin['_wrapper'] = preg_replace( "#img\s+?src=[\"']style_(images|avatars|emoticons)(.+?)[\"'](.+?)?".">#is", "img src=\"".$ibforums->vars['ipb_img_url']."style_\\1\\2\"\\3>", $ibforums->skin['_wrapper'] );
}
$this->_finish();
require ROOT_PATH."FURL.php";
#
# Active le mod_rewrite
#
RewriteEngine On
# Si ton serveur donc ton NDD pointe sur un repertoire differrent
# que celui de www. tu enleves le # de RewriteBase
# et moi pour lycos webcenter payant j'ai du mettre ceci
# RewriteBase /data/members/paid/c/e/cequilfautdire.com/htdocs/adaweb.
# ceci dit c'est pour un sous-domaine. sinon tu touche pas
# RewriteBase www/YourForumDirectory
#
# Règles
#
# DO THE TOPIC URLS
RewriteRule ^(.*)-t([0-9]*)-s([0-9]*)\.html(.*)$ index.php?showtopic=$2&st=$3
RewriteRule ^(.*)-t([0-9]*)\.html(.*)$ index.php?showtopic=$2$3
# DO THE FORUM URLS
RewriteRule ^(.*)-new-topic-f([0-9]*)\.html(.*)$ index.php?act=Post&CODE=00&f=$2$3
RewriteRule ^(.*)-new-poll-f([0-9]*)\.html(.*)$ index.php?act=Post&CODE=10&f=$2$3
RewriteRule ^(.*)-f([0-9]*)\.html(.*)$ index.php?showforum=$2$3
# CALENDER
RewriteRule ^(.*)-e([0-9]*)\.html(.*)$ index.php?act=calendar&code=showevent&eventid=$2$3
RewriteRule ^add-new-event\.html(.*)$ index.php?act=calendar&code=newevent$1
RewriteRule ^events-this-month\.html(.*)$ index.php?act=calendar&code=find&what=thismonth$1
RewriteRule ^events-this-week\.html(.*)$ index.php?act=calendar&code=find&what=thisweek$1
RewriteRule ^go-to-month-([0-9]*)-([0-9]*)\.html(.*)$ index.php?act=calendar&m=$1&y=$2$3
RewriteRule ^show-week-([0-9]*)\.html(.*)$ index.php?act=calendar&code=showweek&week=$1$2
RewriteRule ^show-day-([0-9]*)-([0-9]*)-([0-9]*)\.html(.*)$ index.php?act=calendar&code=showday&y=$3&m=$2&d=$1$4
RewriteRule ^calendar\.html(.*)$ index.php?act=calendar$1
# DO EMAIL AND PM URLS
RewriteRule ^(.*)-a-private-message-m([0-9]*)\.html(.*)$ index.php?act=Msg&CODE=4&MID=$2$3
RewriteRule ^(.*)-an-email-m([0-9]*)\.html(.*)$ index.php?act=Mail&CODE=00&MID=$2$3
# DO THE PROFILE URLS
RewriteRule ^(.*)-m([0-9]*)\.html(.*)$ index.php?showuser=$2$3
# Login/Logout
RewriteRule ^logout\.html(.*)$ index.php?act=Login&CODE=03$1
RewriteRule ^login\.html(.*)$ index.php?act=Login&CODE=00$1
RewriteRule ^register\.html(.*)$ index.php?act=Reg&CODE=00$1
# STATS AND LEGENDS
RewriteRule ^the-moderating-team\.html(.*)$ index.php?act=Stats&CODE=leaders$1
RewriteRule ^todays-top-10-posters\.html(.*)$ index.php?act=Stats$1
# MEMBERS LIST
RewriteRule ^member-list\.html(.*)$ index.php?act=Members$1
# HELP
RewriteRule ^(.*)-h([0-9]*)\.html(.*)$ index.php?act=help&CODE=01&HID=$2$3
RewriteRule ^(.*)help\.html(.*)$ index.php?act=Help$3
# USER CP
RewriteRule ^my-controls\.html(.*)$ index.php?act=UserCP&CODE=00$1
# MESSENGER
RewriteRule ^compose-new-message\.html(.*)$ index.php?act=Msg&CODE=04$1
RewriteRule ^inbox\.html(.*)$ index.php?act=Msg&CODE=01&VID=in$1
RewriteRule ^sent-items\.html(.*)$ index.php?act=Msg&CODE=01&VID=sent$1
RewriteRule ^saved-pms\.html(.*)$ index.php?act=Msg&CODE=20$1
RewriteRule ^empty-pm-folders\.html(.*)$ index.php?act=Msg&CODE=delete$1
RewriteRule ^edit-storage-folders\.html(.*)$ index.php?act=Msg&CODE=07$1
RewriteRule ^pm-buddies\.html(.*)$ index.php?act=Msg&CODE=02$1
RewriteRule ^archive-messages\.html(.*)$ index.php?act=Msg&CODE=14$1
RewriteRule ^message-tracker\.html(.*)$ index.php?act=Msg&CODE=30$1
# SUBSCRIPTIONS
RewriteRule ^view-topic-subscriptions\.html(.*)$ index.php?act=UserCP&CODE=26$1
RewriteRule ^view-forum-subscriptions\.html(.*)$ index.php?act=UserCP&CODE=50$1
# PERSONAL PROFILE
RewriteRule ^edit-profile-info\.html(.*)$ index.php?act=UserCP&CODE=01$1
# GET NEW POSTS
RewriteRule ^get-new-posts\.html(.*)$ index.php?act=Search&CODE=getnew$1
# DO THE FORUM INDEX
RewriteRule ^forums\.html(.*)$ index.php?act=idx$3
# FORUM URLS
RewriteRule ^(.*)-new-topic-f([0-9]*)\.html(.*)$ index.php?act=Post&CODE=00&f=$2$3
# FORUM URLS
RewriteRule ^(.*)-nouveau-sujet-n([0-9]*)\.html(.*)$ index.php?act=Post&CODE=00&f=$2$3
<?php
//Friendly URL Mod for Invision Power Board 2.0
$FURL = new FURL;
$oldskin = "";
while ($ibforums->skin['_wrapper']!=$oldskin){
$oldskin = $ibforums->skin['_wrapper'];
// Do the topics
$ibforums->skin['_wrapper'] = preg_replace("#index.php\?showtopic=([0-9]*)\"#ie","\$FURL->create_topic_url('\\1')", $ibforums->skin['_wrapper'],1);
$ibforums->skin['_wrapper'] = preg_replace("#index.php\?showtopic=([0-9]*)&hl=\"#ie","\$FURL->create_topic_url('\\1')", $ibforums->skin['_wrapper'],1);
$ibforums->skin['_wrapper'] = preg_replace("#index.php\?showtopic=([0-9]*)&st=([0-9]*)\"#ie","\$FURL->create_topic_url('\\1','\\2')", $ibforums->skin['_wrapper'],1);
// Do the forums
$ibforums->skin['_wrapper'] = preg_replace("#index.php\?showforum=([0-9]*)#ie","\$FURL->create_forum_url('\\1')",$ibforums->skin['_wrapper'],1);
// Create Topic/Poll URL
$ibforums->skin['_wrapper'] = preg_replace("#index.php\?act=Post&CODE=00&f=([0-9]*)#ie","\$FURL->create_create_topic_url('\\1')",$ibforums->skin['_wrapper'],1);
$ibforums->skin['_wrapper'] = preg_replace("#index.php\?act=Post&CODE=10&f=([0-9]*)#ie","\$FURL->create_create_poll_url('\\1')",$ibforums->skin['_wrapper'],1);
// Calendar
$ibforums->skin['_wrapper'] = preg_replace("#index.php\?act=calendar&CODE=showevent&eventid=([0-9]*)#ie","\$FURL->create_event_url('\\1')",$ibforums->skin['_wrapper'],1);
// Help
$ibforums->skin['_wrapper'] = preg_replace("#index.php\?act=Help&CODE=01&HID=([0-9]*)#ie","\$FURL->create_help_url('\\1')",$ibforums->skin['_wrapper'],1);
// Profiles
$ibforums->skin['_wrapper'] = preg_replace("#index.php\?showuser=([0-9]*)#ie","\$FURL->create_member_url('\\1')",$ibforums->skin['_wrapper'],1);
//>PM and Email URL's
$ibforums->skin['_wrapper'] = preg_replace("#index.php\?act=Msg&CODE=4&MID=([0-9]*)#ie","\$FURL->create_member_pm_url('\\1')",$ibforums->skin['_wrapper'],1);
$ibforums->skin['_wrapper'] = preg_replace("#index.php\?act=Mail&CODE=00&MID=([0-9]*)#ie","\$FURL->create_member_email_url('\\1')",$ibforums->skin['_wrapper'],1);
}
// UserCP
$ibforums->skin['_wrapper'] = preg_replace("'index.php\?act=UserCP&CODE=00'","my-controls.html",$ibforums->skin['_wrapper']);
//>Messenger
$ibforums->skin['_wrapper'] = preg_replace("'index.php\?act=Msg&CODE=04'","compose-new-message.html",$ibforums->skin['_wrapper']);
$ibforums->skin['_wrapper'] = preg_replace("'index.php\?act=Msg&CODE=01&VID=in'","inbox.html",$ibforums->skin['_wrapper']);
$ibforums->skin['_wrapper'] = preg_replace("'index.php\?act=Msg&CODE=01&VID=sent'","sent-items.html",$ibforums->skin['_wrapper']);
$ibforums->skin['_wrapper'] = preg_replace("'index.php\?act=Msg&CODE=20'","saved-pms.html",$ibforums->skin['_wrapper']);
$ibforums->skin['_wrapper'] = preg_replace("'index.php\?act=Msg&CODE=delete'","empty-pm-folders.html",$ibforums->skin['_wrapper']);
$ibforums->skin['_wrapper'] = preg_replace("'index.php\?act=Msg&CODE=07'","edit-storage-folders.html",$ibforums->skin['_wrapper']);
$ibforums->skin['_wrapper'] = preg_replace("'index.php\?act=Msg&CODE=02'","pm-buddies.html",$ibforums->skin['_wrapper']);
$ibforums->skin['_wrapper'] = preg_replace("'index.php\?act=Msg&CODE=14'","archive-messages.html",$ibforums->skin['_wrapper']);
$ibforums->skin['_wrapper'] = preg_replace("'index.php\?act=Msg&CODE=30'","message-tracker.html",$ibforums->skin['_wrapper']);
//>Subscriptions
$ibforums->skin['_wrapper'] = preg_replace("'index.php\?act=UserCP&CODE=26'","view-topic-subscriptions.html",$ibforums->skin['_wrapper']);
$ibforums->skin['_wrapper'] = preg_replace("'index.php\?act=UserCP&CODE=50'","view-forum-subscriptions.html",$ibforums->skin['_wrapper']);
//>Personal Profile
$ibforums->skin['_wrapper'] = preg_replace("'index.php\?act=UserCP&CODE=01'","edit-profile-info.html",$ibforums->skin['_wrapper']);
// Search URL's
$ibforums->skin['_wrapper'] = preg_replace("'index.php\?act=Search&CODE=getnew'","get-new-posts.html",$ibforums->skin['_wrapper']);
// Do the forum index
$ibforums->skin['_wrapper'] = preg_replace("'index.php\?act=idx'","forums.html",$ibforums->skin['_wrapper']);
// Help
$ibforums->skin['_wrapper'] = preg_replace("'index.php\?act=Help'","help.html",$ibforums->skin['_wrapper']);
// Login/Logout/Register
$ibforums->skin['_wrapper'] = preg_replace("'index.php\?act=Login&CODE=03'","logout.html",$ibforums->skin['_wrapper']);
$ibforums->skin['_wrapper'] = preg_replace("'index.php\?act=Login&CODE=00'","login.html",$ibforums->skin['_wrapper']);
$ibforums->skin['_wrapper'] = preg_replace("'index.php\?act=Reg&CODE=00'","register.html",$ibforums->skin['_wrapper']);
// Stats and legends
$ibforums->skin['_wrapper'] = preg_replace("'index.php\?act=Stats&CODE=leaders'","the-moderating-team.html",$ibforums->skin['_wrapper']);
$ibforums->skin['_wrapper'] = preg_replace("'index.php\?act=Stats'","todays-top-10-posters.html",$ibforums->skin['_wrapper']);
// Members List
$ibforums->skin['_wrapper'] = preg_replace("'index.php\?act=Members'","member-list.html",$ibforums->skin['_wrapper']);
// Calendar
$ibforums->skin['_wrapper'] = preg_replace("'index.php\?act=calendar&CODE=newevent'","add-new-event.html",$ibforums->skin['_wrapper']);
$ibforums->skin['_wrapper'] = preg_replace("'index.php\?act=calendar&CODE=find&what=thismonth'","events-this-month.html",$ibforums->skin['_wrapper']);
$ibforums->skin['_wrapper'] = preg_replace("'index.php\?act=calendar&CODE=find&what=thisweek'","events-this-week.html",$ibforums->skin['_wrapper']);
$ibforums->skin['_wrapper'] = preg_replace("'index.php\?act=calendar&m=([0-9]*)&y=([0-9]*)'","go-to-month-\\1-\\2.html",$ibforums->skin['_wrapper']);
$ibforums->skin['_wrapper'] = preg_replace("'index.php\?act=calendar&CODE=showweek&week=([0-9]*)'","show-week-\\1.html",$ibforums->skin['_wrapper']);
$ibforums->skin['_wrapper'] = preg_replace("'index.php\?act=calendar&CODE=showday&y=([0-9]*)&m=([0-9]*)&d=([0-9]*)'","show-day-\\3-\\2-\\1.html",$ibforums->skin['_wrapper']);
$ibforums->skin['_wrapper'] = preg_replace("'index.php\?&act=calendar&CODE=showday&y=([0-9]*)&m=([0-9]*)&d=([0-9]*)'","show-day-\\3-\\2-\\1.html",$ibforums->skin['_wrapper']);
$ibforums->skin['_wrapper'] = preg_replace("'index.php\?act=calendar'","calendar.html",$ibforums->skin['_wrapper']);
$ibforums->skin['_wrapper'] = preg_replace("'index.php\?&act=calendar'","calendar.html",$ibforums->skin['_wrapper']);
class FURL {
function FURL()
{
}
function create_create_topic_url($fid){
global $DB;
$DB->simple_construct( array( 'select' => '*', 'from' => 'forums', 'where' => 'id ='.$fid ));
$DB->simple_exec();
if ($row = $DB->fetch_row()) {
$forum = $row;
$forum['name'] = $this->make_text_safe($forum['name']);
return $forum['name']."-new-topic-f{$fid}.html";
}
}
function create_create_poll_url($fid){
global $DB;
$DB->simple_construct( array( 'select' => '*', 'from' => 'forums', 'where' => 'id ='.$fid ));
$DB->simple_exec();
if ($row = $DB->fetch_row()) {
$forum = $row;
$forum['name'] = $this->make_text_safe($forum['name']);
return $forum['name']."-new-poll-f{$fid}.html";
}
}
function create_topic_url($tid,$seite=0){
global $DB;
$DB->simple_construct( array( 'select' => 'title', 'from' => 'topics', 'where' => 'tid ='.$tid ));
$DB->simple_exec();
if ($row = $DB->fetch_row()) {
$topic = $row;
$topic_name = $this->make_text_safe($topic['title']);
if ($seite!=0) return $topic_name."-t{$tid}-s{$seite}.html\""; else return $topic_name."-t{$tid}.html\"";
}
}
function create_forum_url($fid)
{
global $DB, $ibforums;
$forum = $ibforums->cache['forum_cache'][$fid]['name'];
$forum = $this->make_text_safe($forum);
return $forum."-f{$fid}.html";
}
function create_event_url($eventid){
global $DB;
$DB->simple_construct( array( 'select' => '*', 'from' => 'calendar_events', 'where' => 'eventid ='.$eventid ));
$DB->simple_exec();
if ($row = $DB->fetch_row()) {
$event = $row;
$event['title'] = $this->make_text_safe($event['title']);
return $event['title']."-e{$eventid}.html";
}
}
function create_help_url($hid){
global $DB;
$DB->simple_construct( array( 'select' => '*', 'from' => 'faq', 'where' => 'id = '.$hid ));
$DB->simple_exec();
if ($row = $DB->fetch_row()) {
$help = $row;
$help['title'] = $this->make_text_safe($help['title']);
return $help['title']."-h{$hid}.html";
}
}
function create_member_url($mid){
global $DB;
if ($mid != "") {
$member = $this->get_member($mid);
$member['name'] = $this->make_text_safe($member['name']); }
return $member['name']."-m{$mid}.html";
}
function create_member_pm_url($mid){
global $DB;
$member = $this->get_member($mid);
$member['name'] = $this->make_text_safe($member['name']);
return "send-".$member['name']."-a-private-message-m{$mid}.html";
}
function create_member_email_url($mid){
global $DB;
$member = $this->get_member($mid);
$member['name'] = $this->make_text_safe($member['name']);
return "send-".$member['name']."-an-email-m{$mid}.html";
}
function get_member($mid){
global $DB;
$DB->simple_construct( array( 'select' => '*', 'from' => 'members', 'where' => 'id ='.$mid ));
$DB->simple_exec();
if ($row = $DB->fetch_row()) {
return $row;
}
}
function make_text_safe($text){
//Charachters must be in ASCII and certain ones aint allowed
$text = preg_replace("#&\#([0-9]*);#ie","_",$text);
$text = html_entity_decode ($text);
$text = str_replace(" / ","_",$text);
$text = str_replace("/","_",$text);
$text = str_replace("'","_",$text);
$text = str_replace(" - ","_",$text);
$text = str_replace("-","_",$text);
$text = str_replace(" ","_",$text);
$text = str_replace( "ä", "ae", $text);
$text = str_replace( "ö", "oe", $text);
$text = str_replace( "ü", "ue", $text);
$text = str_replace( "Ä", "Ae", $text);
$text = str_replace( "Ö", "Oe", $text);
$text = str_replace( "Ü", "Ue", $text);
$text = str_replace( "ß", "ss", $text);
$text = str_replace( "&", "and", $text);
$text = str_replace( "%", "Percent", $text);
//Polish Characters
$text = str_replace( "?", "l", $text);
$text = str_replace( "ó", "o", $text);
$text = str_replace( "?", "n", $text);
$text = str_replace( "?", "c", $text);
$text = str_replace( "?", "z", $text);
$text = str_replace( "?", "z", $text);
$text = str_replace( "?", "s", $text);
$text = str_replace( "?", "a", $text);
$text = str_replace( "?", "e", $text);
$text = ereg_replace("[^A-Za-z0-9_]", "", $text);
$text = str_replace("____","_",$text);
$text = str_replace("___","_",$text);
$text = str_replace("__","_",$text);
return $text;
}
}
?>
105 $forum['name'] = $this->make_text_safe($forum['name']);
106 return $forum['name']."-new-topic-f{$fid}.html";
105 $forum['name'] = $this->make_text_safe($forum['name']);
106 return $forum['name']."-nouveau-sujet-n{$fid}.html";