I
illusion
Прохожие
- Автор темы
- #11
это я понимаю, но я неправильно делю и у меня оишбка получается, всё осталное я уже сделал..осталось тока вывод и ввод ссылок этих
Follow along with the video below to see how to install our site as a web app on your home screen.
Примечание: This feature may not be available in some browsers.
RewriteEngine on
RewriteRule ^index.html$ show.php?cat=index
RewriteRule ^doc.html$ show.php?cat=doc
RewriteRule ^doc_([0-9]{1,3}).html$ show.php?cat=doc&id=$1
RewriteRule ^humor.html$ show.php?cat=humor
RewriteRule ^humor_([0-9]{1,3}).html$ show.php?cat=humor&id=$1
RewriteRule ^soft.html$ show.php?cat=soft
RewriteRule ^soft_([0-9]{1,3}).html$ show.php?cat=soft&id=$1
не быстро, но актуальноДля просмотра ссылки Войдиили Зарегистрируйся
код _modrwrt.php
<?php
define('_MODRWRT_SEP_','/');
define('_MODRWRT_ADDITIONAL_','/');
define('_MODRWRT_POWER_',1);
if(_MODRWRT_POWER_ === 1) {
function makeModRwrt($input) {
if(!empty($input)) {
$matches = array("д","ц","ь","Я");
$replaces = array("ae","oe","ue","ss");
$repl = str_replace($matches,$replaces,strtolower($input));
$i=0;
$out = "";
for($i=0;isset($repl[$i]);$i++) {
if(preg_match('/[a-z0-9_-]/',$repl[$i])) $out .= $repl[$i];
else $out .= "_";
}
$repl = preg_replace("/_{2,}/","_",$out); // ERSETZT MEHRFACHE _
$length = strlen($repl);
if($repl[$length-1] == "_") $repl = substr($repl,0,$length-1); // KILLT _ AM ENDE
if($repl[0] == "_") $repl = substr($repl,1,$length); // KILLT _ AM ANFG
return $repl;
}
}
function mr_title_news($input) {
if(isset($input['newsID'])) {
$title = mysql_fetch_array(safe_query("SELECT headline FROM ".PREFIX."news_contents WHERE newsID=".$input['newsID']));
return $title['headline'];
}
}
function mr_title_topic($input) {
if(isset($input['topic'])) {
$topicID = $input['topic'];
$ds=mysql_fetch_array(safe_query("SELECT topic FROM ".PREFIX."forum_topics WHERE topicID='$topicID'"));
return $ds['topic'];
}
}
function mr_title_article($input) {
if(isset($input['articlesID'])) {
$articlesID = $input['articlesID'];
$ds=mysql_fetch_array(safe_query("SELECT title FROM ".PREFIX."articles WHERE articlesID='$articlesID'"));
return $ds['title'];
}
}
function mr_title_profile($input) {
if(isset($input['id'])) {
return getnickname($input['id']);
}
}
$mod_titles = array(
'news_comments'=>"mr_title_news",
'forum_topic'=>"mr_title_topic",
'profile'=>"mr_title_profile",
'articles'=>'mr_title_article',
);
$req_uri = explode(_MODRWRT_SEP_,$_SERVER['REQUEST_URI']);
$req_path = explode(DIRECTORY_SEPARATOR,dirname(__FILE__));
foreach($req_uri as $parameter) {
if(empty($parameter) || in_array($parameter,$req_path)) {
array_shift($req_uri);
}
else break;
}
$count = count($req_uri);
if($count && substr($req_uri[0],0,9) != "index.php") {
if(empty($req_uri[$count-1])) array_pop($req_uri);
$site = array_shift($req_uri);
$_GET['site'] = $site;
$i = 0;
while(isset($req_uri[$i])) {
$split = explode("-",$req_uri[$i]);
if(count($split) == 2) {
$_GET[$split[0]] = $split[1];
$_REQUEST[$split[0]] = $split[1];
}
$i++;
}
}
function parseUrl($url) {
global $mod_sites, $mod_titles;
$url[0] = substr($url[0],10);
$a_url = explode('&',$url[0]);
$site = explode("=",array_shift($a_url));
$site = $site[1];
$ret = $site;
$params = array();
if(count($a_url)) {
foreach($a_url as $par) {
$split = explode("=",$par);
$ret .= _MODRWRT_SEP_;
if($special) $ret .= $split[1];
else $ret .= $split[0].'-'.$split[1];
$params[$split[0]] = $split[1];
}
}
if(isset($mod_titles[$site])) {
$title = $mod_titles[$site]($params);
$addtitle = makeModRwrt($title);
$ret .= _MODRWRT_SEP_.makeModRwrt($addtitle);
}
$ret .= _MODRWRT_ADDITIONAL_;
return $ret;
}
function out_buffer($buffer) {
return preg_replace_callback('/index\.php\?([^"\']+)/','parseUrl',$buffer);
}
ob_start("out_buffer");
}
?>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php