How can I use a /whatever instead of a /this?w=whatever in my site.
and be able to do things (look up in sql database) with that string
Like Rob said. I'll add some mod_rewrite example though:
so let's say you have this url:
and you want this:
You'll need to open the httpd.conf file and write the following.
<IfModule mod_rewrite.c> RewriteEngine on # activates the rewrite engine RewriteRule /search/([a-z_]+)/ /search.php?s=$1 </IfModule>
there's 2 important part in the RewriteRule line.
- /search/([a-z_]+)/ : This means "keep in mind more than 1 small letter from a to z including the _ after /search/
- /search.php?s=$1: This part means: "Redirect that to search.php and add a S get parameter with the part I asked you to keep earlier"
It's hard to get it right at first so don't try it on a production server. I always test my rewrite rule in my dev environment first. Go read that intro now :)