Forum Moderators: phranque
ive tryed and tryed to get things working on my site with no sucess
so im pleeding for some help :)
my site www.mydomain/listing.php?cityname=3
where cityname3 = to Sydney
aswell as www.mydomain/listing.php?Catid=11&cityname=3
where catid11 = to cafe
so in the ideal world i would like-
www.mydomain/listing.php?Catid=11&cityname=3
to read
www.mydomain/cafe/sydney
is this even possible and if so ANY help is appreciated
thanks in advance eggenz
In other words, most of the work needs to happen where you have access to the database that can be used to translate "3" to Sydney and "11" to cafe -- in the script itself.
You *can* do this using mod_rewrite's RewriteMap directive, but you still need a server-side script (e.g. PERL) to access the database to translate the words in requested URLs to the name/value pairs needed to invoke your .php script, and you still need to modify the original PHP script to translate the name/value pairs back to words to generate the friendly on-page links. So generally, it's less work to do it all in the original script.
To rewrite all extensionless URLs to your script, something like:
RewriteRule ^(([^/]+/)*([^./])?)$ /index.php?URL-path=$1 [L]
The result of requesting example.com/Sydney/cafe from your server will be a call to index.php with a query string of "URL-path=Sydney/cafe". This is a internal filepath, and not a URL; It *will not* be visible to users or to search engines.
You could also simply access the local URL-path as a server variable from within your script itself.
Jim
you might be able to solve this using the RewriteMap directive of the apache mod_rewrite module [httpd.apache.org]
Jim