This guide will let you know how to remove ID from URL news publication in DLE:
1. Open the file / engine / engine.php and look for the code:
// ################ news #################
if ($subaction != '' or $newsid) {
if (! $newsid) $sql_news = "SELECT id, autor, date, short_story, full_story, xfields, title, category, descr, keywords, alt_name, comm_num, allow_comm, allow_rate, fixed, rating, vote_num, news_read, approve, votes, access, flag, editdate, editor, reason, view_edit, tags, metatitle FROM " . PREFIX . "_post WHERE alt_name ='$news_name' AND date >= '{$year}-{$month}-{$day}' AND date < '{$year}-{$month}-{$day}' + INTERVAL 24 HOUR LIMIT 0,1";
else $sql_news = "SELECT id, autor, date, short_story, full_story, xfields, title, category, descr, keywords, alt_name, comm_num, allow_comm, allow_rate, fixed, rating, vote_num, news_read, approve, votes, access, flag, editdate, editor, reason, view_edit, tags, metatitle FROM " . PREFIX . "_post where id = '$newsid'";
if ($subaction == '') $subaction = "showfull";
}
}
is replaced by: // ################ News entirely #################
if ($subaction != '' or $_GET['newsid']) {
if (! $_GET['newsid']) $sql_news = "SELECT id, autor, date, short_story, full_story, xfields, title, category, descr, keywords, alt_name, comm_num, allow_comm, allow_rate, fixed, rating, vote_num, news_read, approve, votes, access, flag, editdate, editor, reason, view_edit, tags, metatitle FROM " . PREFIX . "_post WHERE alt_name ='$news_name' AND date >= '{$year}-{$month}-{$day}' AND date < '{$year}-{$month}-{$day}' + INTERVAL 24 HOUR LIMIT 0,1";
else $sql_news = "SELECT id, autor, date, short_story, full_story, xfields, title, category, descr, keywords, alt_name, comm_num, allow_comm, allow_rate, fixed, rating, vote_num, news_read, approve, votes, access, flag, editdate, editor, reason, view_edit, tags, metatitle FROM " . PREFIX . "_post where alt_name = '{$_GET['newsid']}'";
if ($subaction == '') $subaction = "showfull";
}
}
2. The files / engine / modules / show.short.php, show.custom.php, topnews.php looking for: if( $row['category'] and $config['seo_type'] == 2 ) {
$full_link = $config['http_home_url'] . get_url( $row['category'] ) . "/" . $row['id'] . "-" . $row['alt_name'] . ".html";
} else {
$full_link = $config['http_home_url'] . $row['id'] . "-" . $row['alt_name'] . ".html";
}
} else {
$full_link = $config['http_home_url'] . date( 'Y/m/d/', $row['date'] ) . $row['alt_name'] . ".html";
}
} else {
$full_link = $config['http_home_url'] . "index.php?newsid=" . $row['id'];
}
and replace with:
if( $row['category'] and $config['seo_type'] == 2 ) {
$full_link = $config['http_home_url'] . get_url( $row['category'] ) . "/" . $row['alt_name'] . ".html";
} else {
$full_link = $config['http_home_url'] . $row['alt_name'] . ".html";
}
} else {
$full_link = $config['http_home_url'] . date( 'Y/m/d/', $row['date'] ) . $row['alt_name'] . ".html";
}
} else {
$full_link = $config['http_home_url'] . "index.php?newsid=" . $row['alt_name'];
}
3. Open the file /. Htaccess and are looking for: RewriteRule ^([^.]+)/([0-9]+)-(.*).html(/?)+$ index.php?newsid=$2 [L]
is replaced by: RewriteRule ^([^.]+)/(.*).html(/?)+$ index.php?newsid=$2 [L]
looking for: RewriteRule ^([0-9]+)-(.*).html(/?)+$ index.php?newsid=$1 [L]
is replaced by: RewriteRule ^(.*).html(/?)+$ index.php?newsid=$1 [L]
cut and paste to the end of the file the following code: # Himself post
RewriteRule ^([0-9]{4})/([0-9]{2})/([0-9]{2})/page,([0-9]+),([0-9]+),(.*).html(/?)+$ index.php?subaction=showfull&year=$1&month=$2&day= $3&news_page=$4&cstart=$5&news_name=$6 [L]
RewriteRule ^([0-9]{4})/([0-9]{2})/([0-9]{2})/page,([0-9]+),(.*).html(/?)+$ index.php?subaction=showfull&year=$1&month=$2&day= $3&news_page=$4&news_name=$5 [L]
RewriteRule ^([0-9]{4})/([0-9]{2})/([0-9]{2})/print:page,([0-9]+),(.*).html(/?)+$ engine/print.php?subaction=showfull&year=$1&month=$2&day= $3&news_page=$4&news_name=$5 [L]
RewriteRule ^([0-9]{4})/([0-9]{2})/([0-9]{2})/(.*).html(/?)+$ index.php?subaction=showfull&year=$1&month=$2&day= $3&news_name=$4 [L]
RewriteRule ^([^.]+)/page,([0-9]+),([0-9]+),([0-9]+)-(.*).html(/?)+$ index.php?newsid=$4&news_page=$2&cstart=$3 [L]
RewriteRule ^([^.]+)/page,([0-9]+),([0-9]+)-(.*).html(/?)+$ index.php?newsid=$3&news_page=$2 [L]
RewriteRule ^([^.]+)/print:page,([0-9]+),([0-9]+)-(.*).html(/?)+$ engine/print.php?news_page=$2&newsid=$3 [L]
RewriteRule ^([^.]+)/(.*).html(/?)+$ index.php?newsid=$2 [L]
RewriteRule ^page,([0-9]+),([0-9]+),([0-9]+)-(.*).html(/?)+$ index.php?newsid=$3&news_page=$1&cstart=$2 [L]
RewriteRule ^page,([0-9]+),([0-9]+)-(.*).html(/?)+$ index.php?newsid=$2&news_page=$1 [L]
RewriteRule ^print:page,([0-9]+),([0-9]+)-(.*).html(/?)+$ engine/print.php?news_page=$1&newsid=$2 [L]
RewriteRule ^(.*).html(/?)+$ index.php?newsid=$1 [L]
4. Whatever with the older types of links going to redirect links must open a new kind of file / engine / modules / show.full.php, find the code: @header( "HTTP/1.0 404 Not Found" );
msgbox( $lang['all_err_1'], $lang['news_err_12'] );
}
and substituted: preg_match("/([0-9]*)-(.+?).html$/i", $_SERVER["REQUEST_URI"], $res);
if(intval($res[1]) > 0){
header('HTTP/1.1 301 Moved Permanently');
header('Location: '.$config['home_url'].$res['2'].'.html');
exit;
}
find: $news_found = TRUE;
add below: if($config['allow_alt_url'] == "yes"){
preg_match( '/'.$row['id'].'-(.*?).html/is' , $_SERVER["REQUEST_URI"] , $parse_alt_name );
if($row['alt_name'] != trim($parse_alt_name[1]) )$news_found = FALSE; if( !$news_found ) break;
}
WARNING! If you have a lot of old news, think twice before doing this installation. Many pages on the fly time from the index. For new data resources hack dle remove ID from the URL news publications fits perfectly. Download the archive with this setting Download DLE-HAK-ID
Pass Unrar: dle-guides.blogspot.com
Aucun commentaire:
Enregistrer un commentaire