You can use Javascript to make it site.com/search/developer . For the extremely rare case when Javascript is disabled, you can let them submit a standard HTML form with a final URL like site.com/search.php?kword=developer .
The good news is that with mod_rewrite you can handle both cases to always have a pretty URL in the browser.
Include mod_rewrite and .htaccess through httpd.conf , and then put this code in .htaccess in the DOCUMENT_ROOT directory:
Options +FollowSymLinks -MultiViews # Turn mod_rewrite on RewriteEngine On RewriteBase / # internal forward RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^search/(.+?)/?$ /search.php?kword=$1 [L,QSA,NC] # external rewrite RewriteCond %{THE_REQUEST} ^[AZ]{3,}\s/+search\.php\?kword=([^\s]+) [NC] RewriteRule ^ /search/%1? [R=302,L]
Once you confirm that it is working properly, replace R=302 with R=301 . Avoid using R=301 (Permanent Forwarding) when checking mod_rewrite rules.
source share