Jump to content

Fetch address - write it to .htaccess for NOVICE!


le007

Recommended Posts

Hey all,

 

say my site after going through a search comes up with this address:

http://www.mysite.com/index.php?locate=results&city=DY&minp0&max=9&othercritera=%&moregoeshere

 

how could I get it sent through .htaccess

 

like with this:

 

if I put this in .htaccess instead of http://www.mysite.com/index.php?locate=email

 

RewriteEngine On

RewriteRule ^email$ index.php?locate=email

 

the person would only need to type:

http://www.mysite.com/email

 

Somebody please tell me how to do the same for this:

http://www.mysite.com/index.php?locate=results&city=NYC&minp0&max=9&othercritera=%&moregoeshere

 

so they'd only have to type in:

http://www.mysite.com/nyc

 

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!!!

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

Edit/Delete Message

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.