
February 21st, 2011, 08:45 PM
|
 |
Still alive
|
|
Join Date: Mar 2007
Location: Washington, USA
|
|
mod_rewrite is only the first part. You can get the value "Italy" to a script, and the script determines the country number.
Generic solution:
So say guides.foo is the script you have now. It takes the "country" from the URL. Make it also take the country name (however you decide to do that), then use URL rewriting to turn /guides/XYZ into /guides?whatever=XYZ.
Specific solution:
Apache can do that specific URL right out of the box, as long as /guides is an actual file (like guides.php). With
Code:
Options +MultiViews
/guides/Italy will automatically go to /guides.php. To get to it you look at the CGI PATH_INFO value, which will have "/Italy". Remove the slash, look up the ID corresponding to the county, and you're done. (Or just use different SQL queries or whatever that look at the county name instead of its ID.)
If you need help with the script, be sure to mention what language its uses: PHP, Python, Perl, etc.
|