PHP Dynamic Site and SEO Question

Hello,

I was just wondering if I were to create a dynamic site with PHP that has subsections for each major city, how is the best way to go about this in terms of SEO? I would like have an index page for each city with a link thats accessible through http://www.mysite.com/newyork for example.

Do I need to create an identical index page in each sub folder (i.e. have folders called New York, Los Angeles, etc) in order for it to work, or can I have one index page and that is just built dynamically? So if a user were to go to http://www.mysite.com/newyork or http://www.mysite.com/losangeles, they would go to the same page, but it would be dynamically built based on what link they come in from.

Im sorry if the question is a little unclear, but essentially, I’m just asking if I need to create identical copies of my index page for each city in order for Google to index them, or can I have one page created dynamically and Google will still see each page as a separate city in the search results.

For example, sites like AirBnB I imagine don’t have a new copy of the listing page for each listing since they have a large amount I imagine they have one built dynamically, yet when you search on Google, each listing shows up in the result as being indexed.

Thanks

What you are asking for is essentially what most CMSes do. There are no separate, hard-coded pages. Everything is generated through a single page (e.g. index.php) but the various “pages” that are output to the browser each have their own URL, making them seem like old-fashioned, separate hard-coded pages. Like us, the search engines just see the final result, not the workings in the background. So from their point of view they could be looking at a static site with a multitude of separate, hard-coded pages.

1 Like

Oh alright, that makes sense, thank you!

So how does this work from a PHP coding perspective? When a user enters www.MySite.com/NewYork, for example, do I need to somehow grab the required information from the URL and build the page dynamically from that? Would it be as simple as a GET function using the New York to find the ID? Im assuming the Google search results would work the same way after they have been indexed as well?

Thanks!

I don’t know nearly enough PHP to help you with that, although I think this article is a handy intro to how it can be done (without and with a framework):

As I mentioned, Google sees the site the same way you do—as if it were hard coded. Any request for a page sent to the server kicks the server-side code into action, pulling together the page and content to deliver it back to your browser. This is also what happens (I presume) when Google’s crawlers wander through the site.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.