Assalam.. Selamat sejahtera
Wah!! memandangkan ramai (lebih 3000 pelawat) yang datang melihat web saya sejak tajuk post yang lepas dilancarkan, maka secara tidak langsung, saya telah mendapat lebih daripada 200+ email kepada admin@ mohdhilmi.com yang menanyakan tentang bagaimana saya setup FRIENDLY SEOÂ ke dalam web saya. disini saya BONGKARKAN rahsia saya selama ini mendapat lebih daripada 14 ribu pelawat setiap hari.
Note: you must be using nice permalinks with an Apache web server for this to work as described below.
.htaccess File
Add this mod_rewrite rule in your .htaccess file:
RewriteRule ^search/(.+)?$ /index.php?s=$1 [QSA,L]
UPDATE: Mark informs me that this has actually been built in to WP since 1.5 (meaning this step is not necessary) – who knew? Not me apparently. ![]()
Theme
Add an onsubmit handler to the form tag in the search form in your theme:
<form action="<?php bloginfo('wpurl'); ?>/index.php" method="get" onsubmit="location.href='<?php bloginfo('home'); ?>/search/' + encodeURIComponent(this.s.value).replace(/%20/g, '+'); return false;">
Then… you’re done. but it’s a pretty simple little change.
There’s more than one way to skin a cat, suggestions and improvements to this are welcome in the comments.
Its simple than write an alphabet A-B-C!!
Try it more!!



15 Responses