Jump to content

Fetch address - write it to .htaccess for NOVICE!


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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.