[url rewriting] besoin d'aide[Réglé]

  • Auteur de la discussion Auteur de la discussion A-B
  • Date de début Date de début
A
A-B
Guest
Hello

j'essaye d'appliquer le MOD pour mon forum est a premiere vu il y a truc qui cloche pouvez vous m'aider .

merci

Voici les modifs que j'ai fais.

includes/page_header.php
$template->set_filenames(array(
'overall_header' => ( empty($gen_simple_header) ) ? 'overall_header.tpl' : 'simple_header.tpl')
);
#
ob_start();
function replace_mod_rewrite($s)
{
$urlin = array(
"'(?<!/)viewforum.php\?f=([0-9]*)&amp;topicdays=([0-9]*)&amp;start=([0-9]*)'",
"'(?<!/)viewforum.php\?f=([0-9]*)&amp;mark=topics'",
"'(?<!/)viewforum.php\?f=([0-9]*)'",

"'(?<!/)viewtopic.php\?t=([0-9]*)&amp;view=previous'",
"'(?<!/)viewtopic.php\?t=([0-9]*)&amp;view=next'",
"'(?<!/)viewtopic.php\?t=([0-9]*)&amp;view=newest'",
"'(?<!/)viewtopic.php\?t=([0-9]*)&amp;postdays=([0-9]*)&amp;postorder=([a-zA-Z]*)&amp;start=([0-9]*)'", "'(?<!/)viewtopic.php\?t=([0-9]*)&amp;start=([0-9]*)&amp;postdays=([0-9]*)&amp;postorder=([a-zA-Z]*)&amp;highlight=([a-zA-Z0-9]*)'",
"'(?<!/)viewtopic.php\?t=([0-9]*)&amp;start=([0-9]*)'",
"'(?<!/)viewtopic.php\?t=([0-9]*)'",
"'(?<!/)viewtopic.php\?p=([0-9]*)'");

$urlout = array(
"viewforum\\1-\\2-\\3.html",
"mforum\\1.html",
"forum\\1.html",

"ptopic\\1.html",
"ntopic\\1.html",
"newtopic\\1.html",
"ftopic\\1-\\2-\\3-\\4.html",
"ftopic\\1-\\2-\\3-\\4-\\5.html",
"ftopic\\1-\\2.html",
"ftopic\\1.html",
"sutra\\1.html");

$s = preg_replace($urlin, $urlout, $s);

return $s;
}

#


includes/page_tail.php
#
$db->sql_close();
#

$contents = ob_get_contents();
ob_end_clean();
echo replace_mod_rewrite($contents);
global $dbg_starttime;


#

#
$gzip_contents = ob_get_contents();
ob_end_clean();
#
$gzip_size = strlen($gzip_contents);
$gzip_crc = crc32($gzip_contents);

includes/sessions.php

#
$sql_ip = $user_id == ANONYMOUS ? " AND session_ip = '$user_ip'" : '';
#
$sql = "UPDATE " . SESSIONS_TABLE . "
SET session_ip = '$user_ip', session_start = $current_time, session_time = $current_time, session_page = $page_id, session_logged_in = $login
WHERE session_id = '" . $session_id . "' $sql_ip
AND session_user_id = '$user_id'";
#


$SID = $user_id > 0 ? 'sid=' . $session_id : '';

$SID = $userdata['user_id'] > 0 ? (($sessionmethod == SESSION_METHOD_GET || defined('IN_ADMIN')) ? 'sid=' . $session_id : '') : '';

#
elseif(empty($sessiondata))
{
// try to login guest
$sql = "SELECT u.*, s.*
FROM " . SESSIONS_TABLE . " s, " . USERS_TABLE . " u
WHERE s.session_ip = '$user_ip'
AND s.session_user_id = " . ANONYMOUS . "
AND u.user_id = s.session_user_id
LIMIT 0, 1";
if ( !($result = $db->sql_query($sql)) )
{
message_die(CRITICAL_ERROR, 'Error doing DB query userdata row fetch', '', __LINE__, __FILE__, $sql);
}

$userdata = $db->sql_fetchrow($result);

if ( isset($userdata['user_id']) )
{
if ( $current_time - $userdata['session_time'] > 60 )
{
$sql = "UPDATE " . SESSIONS_TABLE . "
SET session_time = $current_time, session_start = $current_time, session_page = 0
WHERE session_id = '" . $userdata['session_id'] . "'";
if ( !$db->sql_query($sql) )
{
message_die(CRITICAL_ERROR, 'Error updating sessions table', '', __LINE__, __FILE__, $sql);
}
}
return $userdata;
}
}
//
// If we reach here then no (valid) session exists. So we'll create a new one,

le fichier htaccess

RewriteEngine On
RewriteRule ^forums.html index.php
RewriteRule ^mforum([0-9]*).html viewforum.php?f=$1&mark=topics
RewriteRule ^viewforum([0-9]*)-([0-9]*)-([0-9]*).html viewforum.php?f=$1&topicdays=$2&start=$3
RewriteRule ^forum([0-9]*).html viewforum.php?f=$1
RewriteRule ^ptopic([0-9]*).html viewtopic.php?t=$1&view=previous
RewriteRule ^ntopic([0-9]*).html viewtopic.php?t=$1&view=next
RewriteRule ^stopic([0-9]*)-([0-9]*).html viewtopic.php?t=$1&watch=topic&start=$2
RewriteRule ^utopic([0-9]*)-([0-9]*).html viewtopic.php?t=$1&unwatch=topic&start=$2
RewriteRule ^ftopic([0-9]*)-([0-9]*)-([a-zA-Z]*)-([0-9]*).html viewtopic.php?t=$1&postdays=$2&postorder=$3&start=$4
RewriteRule ^ftopic([0-9]*)-([0-9]*).html viewtopic.php?t=$1&start=$2
RewriteRule ^ftopic([0-9]*).html viewtopic.php?t=$1
RewriteRule ^ftopic([0-9]*).html viewtopic.php?t=$1&start=$2&postdays=$3&postorder=$4&highlight=$5
RewriteRule ^setopic_([0-9]*)-([a-zA-Z0-9]*).html viewtopic.php?t=$1&highlight=$2
RewriteRule ^sutra([0-9]*).html viewtopic.php?p=$1
RewriteRule ^newtopic([0-9]*).html viewtopic.php?t=$1&view=newest
 
A
A-B
Guest
desolé :oops:

en gros il me met une fois htlm une fois php et il met aussi

Not Found
The requested document was not found on this server.


--------------------------------------------------------------------------------
 
A
A-B
Guest
Bon j'y suis presque arrivé sauf qu'il y a des trucs qui clochent :lol:


exemple je prends cette url http://www.cichlides.com/forum/forum2.php et je la rennome http://www.cichlides.com/forum/forum2.htlm elle marche mais comment ce fait il qu'elle n'apparaisse pas directement en htlm?

autre chose si je clique sur le titre d'un post qui apparait sur l'index il me donne cette url http://www.cichlides.com/forum/sutra38620.php#38620 comment faire pour virer le sutra au mileu de l'url et qu'il y est a la place cette url http://www.cichlides.com/forum/viewtopi ... htlm#38620?


merci
 
A
A-B
Guest
Oui mais que j'ecrive thlm ou htm sa mrche quand meme .
personne pour m'aider dans mes problemes?

j'ai aussi la connexion auto qui marche plus elle marche mais si on par du forum pendant 15 mn on reviens on est plus connecté

merci
 
WRInaute discret
Eu, t'as pas un probleme ici par hasard ?

Code:
 $urlin = array(
"'(?<!/)viewforum.php\?f=([0-9]*)&amp;topicdays=([0-9]*)&amp;start=([0-9]*)'",
"'(?<!/)viewforum.php\?f=([0-9]*)&amp;mark=topics'",
"'(?<!/)viewforum.php\?f=([0-9]*)'",

"'(?<!/)viewtopic.php\?t=([0-9]*)&amp;view=previous'",
"'(?<!/)viewtopic.php\?t=([0-9]*)&amp;view=next'",
"'(?<!/)viewtopic.php\?t=([0-9]*)&amp;view=newest'",
"'(?<!/)viewtopic.php\?t=([0-9]*)&amp;postdays=([0-9]*)&amp;postorder=([a-zA-Z]*)&amp;start=([0-9]*)'", "'(?<!/)viewtopic.php\?t=([0-9]*)&amp;start=([0-9]*)&amp;postdays=([0-9]*)&amp;postorder=([a-zA-Z]*)&amp;highlight=([a-zA-Z0-9]*)'",
"'(?<!/)viewtopic.php\?t=([0-9]*)&amp;start=([0-9]*)'",
"'(?<!/)viewtopic.php\?t=([0-9]*)'",
"'(?<!/)viewtopic.php\?p=([0-9]*)'");
 
Discussions similaires
Haut