Miscellaneous, Tips & Trick

Building your website but no one visited on it? What’s wrong? You might can advertising with easy to get million traffic daily, But in one day you stop advertising you loose all those potential traffic.

Organic traffic from search engine are the best. Most of webmaster looking for traffic from search engine but they don’t know how to get it.  I know it’s hard, really hard. Beside the topics, keywords, etc most of important thing we almost forgot it is the friendly search engine link.

Most of great search engine love to indexed permanent link (permalink) example http://www.mysite.com/mypage/ or http://www.mysite.com/mypage.html more than dynamic URL example http://www.mysite.com/index.php?page=page1 etc. Even google and most great search engine claim their robot will crawl dynamic URL but most of people doesn’t like it in result. By make your URL friendly will also raised CTR on SERP.

* You should know URL Friendly will not affect on your search engine position ranking.

So let try to make simple Friendly URL using URL rewrite. First write this code on your .htaccess file (you can find this hidden file usually in your website root)

RewriteEngine On
Options +FollowSymLinks

//creating /mypage.html format
RewriteRule ^([0-9a-zA-Z-]+)/?/?.html$ /home/yourusername/public_html/index.php?page=$1

//creating /mypage/ format
RewriteRule ^([0-9a-zA-Z-]+)/?/?/$ /home/yourusername/public_html/index.php?page=$1

* Take attention on modification bold and red font, and in your index.php (Taken from my sample)

<?php

if(isset($_GET[’page’]))
$p = $_GET[’page’];
else
$p = “0″;

switch($p) {
case “tentang-kami”: include(”./pages/tentang-kami.php”); break;
case “kenapa-kami”: include(”./pages/kenapa-kami.php”); break;
case “berita”: include(”./pages/berita.php”); break;
case “promosi”: include(”./pages/promosi.php”); break;
}

?>

Done, you will get friendly URL like this sample on 2 of my site in here and here just waiting until search engine indexed your page and send organic traffic for you. For real sample to make sure URL rewrite working take a look on this page and this page.

Good luck :D

Computer And Internet, Miscellaneous, Tips & Trick

Well, I just have done optimize SEO for one of my website using 4images gallery system it’s on http://www.innovativedesktop.com basically I play with meta title, keywords, and description. And now I’m using URL rewrite. URL look cool and more search engine friendly I believe after a week or month it will indexed in lot of search engine :D

Here is the way for you’re to using URL rewrite on 4images to make it more search engine friendly REMEMBER this will eat CPU resources. (before you doing this I recommended to backup your files first). Any alternative you can learn about URL rewrite yourself to make it works as you want (google is the best teacher).

1. You need to make .htaccess file and put this code on it

RewriteEngine On
RewriteRule ^lightbox\.html$ lightbox.php?%{QUERY_STRING}
RewriteRule ^lightbox\.([0-9]+)\.html$ lightbox.php?page=$1&%{QUERY_STRING}
RewriteRule ^search\.html$ search.php?%{QUERY_STRING}
RewriteRule ^search\.([0-9]+)\.html$ search.php?page=$1&%{QUERY_STRING}
RewriteRule ^postcard([a-zA-Z0-9]+)\.html$ postcards.php?postcard_id=$1&%{QUERY_STRING}
RewriteRule ^postcard\.img([0-9]+)\.html$ postcards.php?image_id=$1&%{QUERY_STRING}
RewriteRule ^k_(.*)_([0-9]+).html categories.php?cat_id=$2&%{QUERY_STRING}
RewriteRule ^r_(.*)_([0-9]+).html details.php?image_id=$2&%{QUERY_STRING}
RewriteRule ^r([0-9]+).search.html details.php?image_id=$1&%{QUERY_STRING}

2. Open /include/sessions.php before the last line add this code

//Mod_bmollet
/**
* Get the category url
* @param int $cat_id The id of the category
* @param string $cat_url The current status of the URL
*/
function get_category_url($cat_id,$cat_url = ”)
{
global $site_db;
$sql = “SELECT cat_name,cat_parent_id FROM “.CATEGORIES_TABLE.” WHERE cat_id = ‘”.$cat_id.”‘”;
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$row[’cat_name’] = strtr($row[’cat_name’], “éèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZ”,”eeeaeauoiaabcdefghijklmnopqrstuvwxyz”);
$cat_url = ‘_’.str_replace(’+',’_',urlencode($row[’cat_name’])).’_’.$cat_id.$cat_url;
// if you want full path of category in url, put next line in comment
return $cat_url;
if( $row[’cat_parent_id’] != 0)
{
return get_category_url($row[’cat_parent_id’],$cat_url);
}
else
{
return $cat_url;
}
}
//Mod_bmollet
/**
* Get the image url
* @param int $image_id The id of the image
*/
function get_image_url($image_id)
{
global $site_db;
$sql = “SELECT cat_id,image_name FROM “.IMAGES_TABLE.” WHERE image_id = ‘”.$image_id.”‘”;
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$row[’image_name’] = strtr($row[’image_name’], “éèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZ”,”eeeaeauoiaabcdefghijklmnopqrstuvwxyz”);
// if you want comlpete path to image in url, remove comment from following line
//return get_category_url($row[’cat_id’]).’-’.str_replace(’+',’-',urlencode($row[’image_name’])).’-’.$image_id;
return ‘_’.str_replace(’+',’_',urlencode($row[’image_name’])).’_’.$image_id;
}
Read More »