Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: Edis2 Klausimai

Parašė Black psycho· 2009 Bal. 14 05:04:10
#34

Mano .htacces dalis su kuria veikia rewrite:
RewriteEngine On

RewriteRule ^.* - [F,L]

RewriteBase /
RewriteCond %{REQUEST_URI} ^/(.*)$
RewriteRule ^straipsniai$ articles.php [N]
RewriteRule ^straipsniu-kategorijos,([0-9]+)$ articles.php?cat_id=$1 [L]
RewriteRule ^straipsnis,([0-9]+)$ readarticle.php?article_id=$1 [L]
RewriteRule ^straipsnis,([0-9]+)-([0-9]+)$ readarticle.php?article_id=$1&rowstart=$2 [L]

RewriteRule ^receptai$ receptai.php [N]
RewriteRule ^receptu-kategorijos,([0-9]+)$ receptai.php?cat_id=$1 [L]
RewriteRule ^receptas,([0-9]+)$ skaitytireceptus.php?receptai_id=$1 [L]
RewriteRule ^receptas,([0-9]+)-([0-9]+)$ skaitytireceptus.php?receptai_id=$1&rowstart=$2 [L]

RewriteRule ^duk$ faq.php [N]
RewriteRule ^duk,([0-9]+)$ faq.php?cat_id=$1 [L]
RewriteRule ^duk,([0-9]+)-([0-9]+)$ faq.php?cat_id=$1&rowstart=$2 [L]

RewriteRule ^naujienu-kategorijos$ news_cats.php [N]
RewriteRule ^naujienos$ news.php [N]
RewriteRule ^naujiena,([0-9]+)$ news.php?readmore=$1 [L]
RewriteRule ^naujiena,([0-9]+)$ news.php?rowstart=$1 [L]
RewriteRule ^naujienu-kategorija,([0-9]+)$ news_cats.php?cat_id=$1 [L]

RewriteRule ^konkursai$ konkursai.php [N]
RewriteRule ^konkursas,([0-9]+)$ konkursai.php?readmore=$1 [L]
RewriteRule ^konkursas,([0-9]+)$ konkursai.php?rowstart=$1 [L]

RewriteRule ^albumas([0-9]+)$ photogallery.php?album_id=$1 [L]
RewriteRule ^albumas,([0-9]+)-([0-9]+)$ photogallery.php?album_id=$1&rowstart=$2 [L]
RewriteRule ^nuotrauka,([0-9]+)$ photogallery.php?photo_id=$1 [L]
RewriteRule ^rodyti-nuotrauka,([0-9]+)$ showphoto.php?photo_id=$1 [L]

RewriteRule ^autorines-teises$ autorines.php [N]
RewriteRule ^reklama$ reklama.php [N]
RewriteRule ^administracija$ administracija.php [N]
RewriteRule ^taisykles$ taisykles.php [N]
RewriteRule ^atsijungti$ setuser.php?logout=yes [N]
RewriteRule ^nariai$ members.php [N]
RewriteRule ^kontaktai$ contact.php [N]
RewriteRule ^galerija$ photogallery.php [N]
RewriteRule ^forumo-paieska$ search.php?stype=f [N]
RewriteRule ^paieska$ search.php [N]
RewriteRule ^profilis,([0-9]+)$ profile.php?lookup=$1 [L]
RewriteRule ^puslapis,([0-9]+)$ viewpage.php?page_id=$1 [L]
RewriteRule ^pateikti-straipsni$ submit.php?stype=a [N]
RewriteRule ^pateikti-recepta$ submit.php?stype=r [N]




ir maincore.php funkcija:
function f_url($buf) {
if(!substr_count($_SERVER[REQUEST_URI],"virtuveje.net-administracija-8B2c6G13tEn")){

$buf = preg_replace('#viewthread\.php\?forum_id=([0-9]*?)(&|&)thread_id=([0-9]*?)\#([0-9]*?)(\'|")#si', 'tema,\1-\3-\4\5', $buf);
$buf = preg_replace('#viewthread\.php\?rowstart=([0-9]*?)(&|&)forum_id=([0-9]*?)(&|&)thread_id=([0-9]*?)\#([0-9]*?)(\'|")#si', 'tema,\1-\3-str\5-\6\7', $buf);

$buf = preg_replace('#viewforum\.php\?forum_id=([0-9]*?)(&|&)rowstart=([0-9]*?)(\'|")#si', 'forumas,\1-str\3\4', $buf);
$buf = preg_replace('#viewthread\.php\?forum_id=([0-9]*?)(&|&)thread_id=([0-9]*?)(\'|")#si', 'tema,\1-\3\4', $buf);
$buf = preg_replace('#viewforum\.php\?forum_id=([0-9]*?)(\'|")#si', 'forumas,\1\2', $buf);
$buf = preg_replace('#viewthread\.php\?rowstart=([0-9]*?)(&|&)forum_id=([0-9]*?)(&|&)thread_id=([0-9]*?)(\'|")#si', 'tema,\3-\5-str\2\6', $buf);
$buf = preg_replace('#viewthread\.php\?forum_id=([0-9]*?)(&|&)thread_id=([0-9]*?)(&|&)pid=([0-9]*?)\#post_([0-9]*?)(\'|")#si', 'tema,\1-\3-\5#post_\6\7', $buf);
$buf = preg_replace('#post\.php\?action=newthread(&|&)forum_id=([0-9]*?)(\'|")#si', 'nauja-tema,\2\3', $buf);
$buf = preg_replace('#viewthread\.php\?forum_id=([0-9]*?)(&|&)thread_id=([0-9]*?)(&|&)rowstart=([0-9]*?)(\'|")#si', 'tema,\1-\3-str\5\6', $buf);
$buf = preg_replace('#post\.php\?action=edit(&|&)forum_id=([0-9]*?)(&|&)thread_id=([0-9]*?)(&|&)post_id=([0-9]*?)(\'|")#si', 'redaguoti,\2-\4-\6\7', $buf);
$buf = preg_replace('#post\.php\?action=reply(&|&)forum_id=([0-9]*?)(&|&)thread_id=([0-9]*?)(\'|")#si', 'atsakyti,\2-\4\5', $buf);
$buf = preg_replace('#post\.php\?action=reply(&|&)forum_id=([0-9]*?)(&|&)thread_id=([0-9]*?)(&|&)post_id=([0-9]*?)(&|&)quote=([0-9]*?)(\'|")#si', 'cituoti,\2-\4-zinute,\6-\8\9', $buf);

$buf = preg_replace('#skaitytireceptus\.php\?article_id=([0-9]*?)(&|&)rowstart([0-9]*?)(\'|")#si', 'receptas,\1-str\3\4', $buf);
$buf = preg_replace('#skaitytireceptus\.php\?article_id=([0-9]*?)(\'|")#si', 'receptas,\1\2', $buf);
$buf = preg_replace('#receptai\.php\?cat_id=([0-9]*?)(\'|")#si', 'receptu-kategorijos,\1\2', $buf);
$buf = preg_replace('#receptai\.php#si', 'receptai', $buf);

$buf = preg_replace('#readarticle\.php\?article_id=([0-9]*?)(&|&)rowstart([0-9]*?)(\'|")#si', 'straipsnis,\1-str\3\4', $buf);
$buf = preg_replace('#readarticle\.php\?article_id=([0-9]*?)(\'|")#si', 'straipsnis,\1\2', $buf);
$buf = preg_replace('#articles\.php\?cat_id=([0-9]*?)(\'|")#si', 'straipsniu-kategorijos,\1\2', $buf);
$buf = preg_replace('#articles\.php#si', 'straipsniai', $buf);

$buf = preg_replace('#news\.php\?rowstart=([0-9]*?)(\'|")#si', 'naujiena,\1\2', $buf);
$buf = preg_replace('#news\.php\?readmore=([0-9]*?)(\'|")#si', 'naujiena,\1\2', $buf);
$buf = preg_replace('#news_cats\.php\?cat_id=([0-9]*?)(\'|")#si', 'naujienu-kategorija,\1\2', $buf);
$buf = preg_replace('#news_cats\.php#si', 'naujienu-kategorijos', $buf);
$buf = preg_replace('#news\.php#si', 'naujienos', $buf);

$buf = preg_replace('#konkursai\.php\?rowstart=([0-9]*?)(\'|")#si', 'konkursas,\1\2', $buf);
$buf = preg_replace('#konkursai\.php\?readmore=([0-9]*?)(\'|")#si', 'konkursas,\1\2', $buf);
$buf = preg_replace('#konkursai\.php#si', 'konkursai', $buf);

$buf = preg_replace('#autorines\.php#si', 'autorines-teises', $buf);
$buf = preg_replace('#reklama\.php#si', 'reklama', $buf);
$buf = preg_replace('#administracija\.php#si', 'administracija', $buf);
$buf = preg_replace('#taisykles\.php#si', 'taisykles', $buf);
$buf = preg_replace('#setuser\.php\?logout=yes#si', 'atsijungti', $buf);
$buf = preg_replace('#forumas/index\.php#si', 'forumas/index', $buf);
$buf = preg_replace('#members\.php#si', 'nariai', $buf);
$buf = preg_replace('#contact\.php#si', 'kontaktai', $buf);
$buf = preg_replace('#search\.php\?stype=f#si', 'forumo-paieska', $buf);
$buf = preg_replace('#search\.php#si', 'paieska', $buf);
$buf = preg_replace('#profile\.php\?lookup=([0-9]*?)(\'|")#si', 'profilis,\1\2', $buf);
$buf = preg_replace('#viewpage\.php\?page_id=([0-9]*?)(\'|")#si', 'puslapis,\1\2', $buf);
$buf = preg_replace('#infusions/button_panel/click\.php\?bid=([0-9]*?)(\'|")#si', 'reklama,\1\2', $buf);

$buf = preg_replace('#submit\.php\?stype=a#si', 'pateikti-straipsni', $buf);
$buf = preg_replace('#submit\.php\?stype=r#si', 'pateikti-recepta', $buf);

$buf = preg_replace('#index\.php#si', 'index', $buf);
$buf = preg_replace('#ion/index#si', 'ion/index.php', $buf);
$buf = preg_replace('#ion/news#si', 'ion/news.php', $buf);
$buf = preg_replace('#ion/articles#si', 'ion/articles.php', $buf);
$buf = preg_replace('#ion/receptai#si', 'ion/receptai.php', $buf);
$buf = preg_replace('#user/index#si', 'user/index.php', $buf);
}
return $buf;
}

// Start Output Buffering
ob_start("f_url");




Atidžiai nagrinėk ir turėtum suprasti. Tik pas mane poto su index būna blogai tai reikėjo redaguot keletą failų o tu gali tiesiog pašalinti index.php "rewritinimą".

Redagavo Black psycho· 2009 Bal. 14 05:04:18