Ubah URL lebih SEO Friendly dengan htaccess


htaccess

sumber gambar : blog.pnyet.web.id

Suatu alamat yang mudah diingat dan SEO friendly tentunya akan mudah terindex di mesin pencari. Selain itu juga pengunjung lebih mudah mengingatnya tanpa harus menyebutkan ID nya, melainkan berupa kalimat atau kata. Continue reading

Advertisements

Ubah URL pada PHP Fusion menjadi URL Friendly


Url yang tidak friendly website bisa rentan kena hack dan kurang bersahabat di gooling dalam proses indexing ke search engine, contohnya adalah http://www.namawebsite.com/article_id=10. Kebanyakan orang mengecek bug websitenya dengan memasukkan tanda petik [‘].

Langkah-langkahnya untuk mengubah menjadi URL Friendly adalah :

1. Buka dan cari file /maincore.php

2. Cari Kode ob_start();

3. Masukkan kode berikut tepat di bawah kode tadi

function 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;
}

4. Buat file dengan nama .htaccess

5. Isikan dengan koder berikut

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/(.*)$
RewriteRule ^articles\.html$ articles.html [N]
RewriteRule ^articles_cat([0-9]+)\.html$ articles.html?cat_id=$1 [L]
RewriteRule ^read-article([0-9]+)\.html$ readarticle.php?article_id=$1 [L]
RewriteRule ^index\.html$ index.php [N]
RewriteRule ^downloads\.html$ downloads.html [N]
RewriteRule ^faq\.html$ faq.html [N]
RewriteRule ^links\.html$ links.html [N]
RewriteRule ^news-categories\.html$ news-categories.html [N]
RewriteRule ^news\.html$ news.php [N]
RewriteRule ^readnews-([0-9]+)\.html$ news.php?readmore=$1 [L]
RewriteRule ^contacts\.html$ contacts.html [N]
RewriteRule ^gallery\.html$ gallery.html [N]
RewriteRule ^search-f\.html$ search-f.html [N]
RewriteRule ^search\.html$ search.html [N]
RewriteRule ^profile-([0-9]+)\.html$ profile.php?lookup=$1 [L]
RewriteRule ^gallery-album([0-9]+)\.html$ gallery.html?album_id=$1 [L]
RewriteRule ^gallery-photo([0-9]+)\.html$ gallery.html?photo_id=$1 [L]
RewriteRule ^showphoto([0-9]+)\.html$ showphoto.php?photo_id=$1 [L]
RewriteRule ^downloads_cat([0-9]+)\.html$ downloads.html?cat_id=$1 [L]
RewriteRule ^downloads_cat([0-9]+)-file([0-9]+)\.html$ downloads.html?cat_id=$1&download_id=$2 [L]
RewriteRule ^faq_cat([0-9]+)\.html$ faq.html?cat_id=$1 [L]
RewriteRule ^links_cat([0-9]+)\.html$ links.html?cat_id=$1 [L]
RewriteRule ^links_cat([0-9]+)-linkid-([0-9]+)\.html$ links.html?cat_id=$1&weblink_id=$2 [L]
RewriteRule ^print_news([0-9]+)\.html$ print.php?type=N&item_id=$1 [L]
RewriteRule ^print_article([0-9]+)\.html$ print.php?type=A&item_id=$1 [L]
RewriteRule ^register\.html$ register.html [N]
RewriteRule ^lostpassword\.html$ lostpassword.html [N]
RewriteRule ^viewpage([0-9]+)\.html$ viewpage.php?page_id=$1 [L]

6. Buka file footer.php di /themes/templates/footer.php

7. Cari kode berikut :

echo handle_output($output);

8. Ganti dengan kode berikut :

echo rewrite_urls(handle_output($output));

9. Lihat hasilnya,,,

NB : sebelumnya backup dulu file yang mau di edit, supaya nanti kalau ada kesalahan bisa dikembalikan seperti semula. 🙂

sumber

Ubah URL pada SMF lebih Friendly


Dalam proses peng-indexan pada search engine, sebuah website disarankan menggunakan url yang lebih friendly. Selain itu juga dapat meningkatkan kemanan dari sql injection.

Dalam settingan default, sebuah website forum menggunakan SMF, biasanya menggunakan url yang kurang friendly, misalnya”http://www.abcd.com/forum/index.php?topic=147.0” nah itu bisa di ubah menjadi lebih singkat menjadi “http://www.abcd.com/forum/tips/cara-membuat-antena/Continue reading