Epson Stylus Photo Printer - Lingerie - Montana Music - Loan - Free Ringtones

PDA

View Full Version : quick help with htaccess...PLEASE!!!


cgo85
Dec 8th 2004, 12:42 am
I'm trying to rewrite my urls. Here is an example of one of my urls:

search-realestate.net/ca-city.php?realtor=Alameda

I tried using something like:

RewriteEngine on
RewriteRule ^([a-z][a-z])-realtor_(.*)\.html$ /([a-z][a-z])-city.php?realtor=$1 [L]

I've tried a couple of different things and either I get a 403 error or a page cannot be found error.

I'm kind of lost right now trying to learn how to do this Please help me!!!!

johnt
Dec 8th 2004, 1:39 am
I think that you need at least one RewriteCond in there, and your RewriteRule is slightly off - you need to use both of the patterns in brackets in your target URL.
You could try

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.search-realestate.net
RewriteRule ^([a-z][a-z])-realtor_(.*)\.html$ /$1-city.php?realtor=$2 [L]

I think that that should do it.

Hope it helps

John

cgo85
Dec 8th 2004, 6:15 am
What would that change the url to look like?

johnt
Dec 8th 2004, 9:29 am
That would change static looking HTML URLs into dynamic PHP URLs, but the user ( and bot ) would still see the HTML URL, which I think is what you're trying to do.

If a user or bot requested
search-realestate.net/ca-realtor_Alameda.html
then the page which would be served would be
search-realestate.net/ca-city.php?realtor=Alameda

likewise
search-realestate.net/ny-realtor_Someoneelse.html
would become
search-realestate.net/ny-city.php?realtor=Someoneelse

You could also try only having 1 php script called city.php, rather than one per city which I guess you currently do from your original RewriteRule, then you could pass the city identifiers into the script as a parameter using this RewriteRule instead of the earlier one.

RewriteRule ^([a-z][a-z])-realtor_(.*)\.html$ /city.php?realtor=$2&city=$1[L]

Hope this clears it up

John

cgo85
Dec 8th 2004, 10:58 am
Johnt, you've been very helpful thank you. As you advised I made one city page. Ok here is the issue... Here is a sample link:

/mls/city.php?realtor=Kuna&state=Idaho

I want the bots and users to see as: /realtor/Idaho/Kuna.htm

So basically: /realtor/state/city.htm

One more thing... When I link to this page would i link to it as:

/mls/city.php?realtor=Kuna&state=Idaho

or

/realtor/Idaho/Kuna.htm

I really appreciate your help!!!

cgo85
Dec 8th 2004, 4:02 pm
I knew that I wasn't too stupid!!! After toying with a bunch of different rewrites I contacted my hosting company cause I knew that something had to be up. Anyhow, they don't allow rewrite configuration on there servers at this time. Thanks anyway johnt.