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!!!!
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
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.htmlthen the page which would be served would be search-realestate.net/ca-city.php?realtor=Alameda likewise search-realestate.net/ny-realtor_Someoneelse.htmlwould 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
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!!!
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.