Forum Moderators: coopster

Message Too Old, No Replies

.htaccess Question

How to create dynamic pages

         

gonzalop

10:01 am on Jul 27, 2011 (gmt 0)

10+ Year Member



I want to know what I need to put in the .htaccess to do the follow.

When people call one of my pages... example

[mydomain.com...]
or
[mydomain.com...]


that it would create these pages on the fly from a file called cookscities.php



Then the pages cookscities.php would pull the values from the URL for the city and state and place it on the page.

So for sample requested page:
[mydomain.com...]

my page
cookscities.php

Inserts value of URL on page content city value but remove the "-" if there is one and also places the state 2 letters.

So the page title would say:

Find Cooks in New York NY

Thanks for help.

g1smd

10:55 am on Jul 27, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Use example.com to stop forum auto-linking.

lucy24

3:26 pm on Jul 27, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Do you have a pre-existing list of possible city names? How long is it? Or are you allowing free input? (The latter would seem to be just begging for trouble.)

If you do have a finite list: do the city names always replace spaces with hyphens, as in "New York"? And is there always a lowline between city and state? Both of those are trivial changes... until you get to a city name that really does contain a hyphen.

But:

When you say "page title" do you mean the text inside the <title>tags</title>? This will be generated by php along with everything else. Or do you mean the user's browser address bar? Please say that's not what you meant, because those spaces would open up a whole world of new problems.