Forum Moderators: phranque
say my site after going through a search comes up with this address:
[mysite.com...]
how could I get it sent through .htaccess
like with this:
if I put this in .htaccess instead of [mysite.com...]
RewriteEngine On
RewriteRule ^email$ index.php?locate=email
the person would only need to type:
[mysite.com...]
Somebody please tell me how to do the same for this:
[mysite.com...]
so they'd only have to type in:
[mysite.com...]
How can the PHP do this on the fly? I really dunno how to do it... fetch it from the db and write it etc - complete novice... I have a mysql db set up with the data in it already.
Thanks!
PS I've tried this:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME}!-f
RewriteCond %{REQUEST_FILENAME}!-d
RewriteRule ^([^/]+)(/([^/]+))?$ index.php?locate=results&city=$1&state=$3&minp0&max=9&othercritera=%&moregoeshere
I tried the above and when I typed in
mywebsite.com/state
it worked but when I typed in
mywebsite.com/state/city it didnt
ALSO how can I have to parsed through the php so
mywebsite.com/state/city appears in the address rather than
index.php?locate=results&city=$1&state=$3&minp0&max=9&othercritera=%&moregoeshere
Thank you
What mod_rewrite can do, is to 'map' one of those friendly URLs, when it is requested from your server, to the correct script/query string call needed to produce the page for that friendly URL.
More info here [webmasterworld.com], including the process to 'clean-up' the unfriendly' URLs in your last question.
Jim