This site is using some script to replace local terms every time they occur in title, url, and text. www.dsl-internet-dsl-service.com/ca/willits.html www.dsl-internet-dsl-service.com/il/chicago.html www.dsl-internet-dsl-service.com/ny/buffalo.html www.dsl-internet-dsl-service.com/va/alexandria.html Notice that every page is the same, except for the state/city name is substituted. It looks like a PHP call function drawing on a MYSQL database, but I really don't know how to set this up. What is this easiest way to apply this principle to a real estate site?
I assume they have assigned a php variable(fetched through Mysql) for the city/states and have used mod rewrite to change the extension from php to html .
That's what I think, too. Anyone care to come up with the code for this? I really don't know enough to write it from scratch.
It's probably using this common htaccss method: RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] HTML: Any request that is not a valid file or directory (basically a 404) will run the index.php file on the server root, without changing the address in the users address bar. You then use your index.php to parse the requested url: $request_parts = split('/', $_SERVER['REQUEST_URI']); PHP: and query your db and display content accordingly.
I run a similar site where the parts changed are city and state. The url part can be done a above. In the index.php I just get the content-template from the database. Eample: Hi from %city%, %sate%! And do: $text = str_replace('%city%', $city, $text); $text = str_replace('%state%', $state, $text); end then echo $text where needed. $city and $state of course holds the city-/state-name called.