Codefunction rewrite_urls($buf) {
if(!substr_count($_SERVER['REQUEST_URI'],"administration")) {
$buf = preg_replace('#readarticle\.php\?article_id=([0-9]*?)(\'|")#si', 'read-article\1.html\2', $buf);
$buf = preg_replace('#articles\.php\?cat_id=([0-9]*?)(\'|")#si', 'articles_cat\1.html\2', $buf);
$buf = preg_replace('#articles\.php#si', 'articles.html', $buf);
$buf = preg_replace('#downloads\.php\?cat_id=([0-9]*?)(\'|")#si', 'downloads_cat\1.html\2', $buf);
$buf = preg_replace('#downloads\.php\?cat_id=([0-9]*?)(&|&)download_id=([0-9]*?)(\'|")#si', 'downloads\1-file-\3.html\4', $buf);
$buf = preg_replace('#downloads\.php#si', 'downloads.html', $buf);
$buf = preg_replace('#faq\.php\?cat_id=([0-9]*?)(\'|")#si', 'faq_cat\1.html\2', $buf);
$buf = preg_replace('#faq\.php#si', 'faq.html', $buf);
$buf = preg_replace('#weblinks\.php\?cat_id=([0-9]*?)(\'|")#si', 'links_cat\1.html\2', $buf);
$buf = preg_replace('#weblinks\.php\?cat_id=([0-9]*?)(&|&)weblink_id=([0-9]*?)(\'|")#si', 'links_cat\1-linkid-\3.html\4', $buf);
$buf = preg_replace('#weblinks\.php#si', 'links.html', $buf);
$buf = preg_replace('#news_cats\.php#si', 'news-categories.html', $buf);
$buf = preg_replace('#news\.php\?readmore=([0-9]*?)(\'|")#si', 'readnews-\1.html\2', $buf);
$buf = preg_replace('#contact\.php#si', 'contacts.html', $buf);
$buf = preg_replace('#photogallery\.php\?album_id=([0-9]*?)(\'|")#si', 'gallery-album\1.html\2', $buf);
$buf = preg_replace('#photogallery\.php\?photo_id=([0-9]*?)(\'|")#si', 'gallery-photo\1.html\2', $buf);
$buf = preg_replace('#showphoto\.php\?photo_id=([0-9]*?)(\'|")#si', 'showphoto\1.html\2', $buf);
$buf = preg_replace('#photogallery\.php#si', 'gallery.html', $buf);
$buf = preg_replace('#search\.php\?stype=f#si', 'search-f.html', $buf);
$buf = preg_replace('#search\.php#si', 'search.html', $buf);
$buf = preg_replace('#profile\.php\?lookup=([0-9]*?)(\'|")#si', 'profile-\1.html\2', $buf);
$buf = preg_replace('#print\.php\?type=N(&|&)item_id=([0-9]*?)(\'|")#si', 'print_news\2.html\3', $buf);
$buf = preg_replace('#print\.php\?type=A(&|&)item_id=([0-9]*?)(\'|")#si', 'rint_article\2.html\3', $buf);
$buf = preg_replace('#register\.php#si', 'register.html', $buf);
$buf = preg_replace('#lostpassword\.php#si', 'lostpassword.html', $buf);
$buf = preg_replace('#viewpage\.php\?page_id=([0-9]*?)(\'|")#si', 'viewpage\1.html\2', $buf);
}
return $buf;
}