SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Wizard holmescreek's Avatar
    Join Date
    Mar 2001
    Location
    Northwest Florida
    Posts
    1,707
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I considering posting this in the Marketing forum but after reviewing some of the posts there it seems to fit better here because of the technical nature. Anway, I'm building a large large informational site using PHP. This is my first PHP project (done many in Perl) so I'm trying to get some ideas of how to structure the overall site.

    I'll have news stories that are uploaded to by staff members to a MySQL database, the top page will list these stories with links to them -- I'll probably use a jump.php script that was discussed in one of the recent SitePoint forums for this. However, I also have static content such as county history, demographics etc that won't require but a few minor changes a year. I was thinking of serving up these pages from the database as well, however, I was thinking if I just creating an html document (from a template) for each page and sticking it into its on directory. This way the search engines could pick up on the content.

    I noticed a lot of sites, like sitepoint, do a jump.php to an article that is in for instance /news/articles/357/. I'm curious, are they using a script that is ran say nightly that pulls the articles from the database and generates a page in unique directories? I use a third party hosting service so I don't think this could be automated. Maybe regenerate the entire site when afer a staff member logs in and uploads the new article to the database?

    Any suggestions or maybe a flowchart of how you have set up the structure of your site (like using templates etc) would be very helpful! The big question here is serving up pages and also provide some meat for any search engines that may be spidering/indexing the site.


    Thanks in advance!

  2. #2
    SitePoint Columnist Skunk's Avatar
    Join Date
    Jan 2001
    Location
    Lawrence, Kansas
    Posts
    2,066
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote time...
    Here's the problem:

    You have a nice databased site, with all content pulled out of the database using the standard /page.php?id=x method. Lots of content, lots of visitors.

    Unfortunately... for one thing the URLs look a bit untidy, and for another thing many search engines ignore anything with a query string (i.e a URL with a ?) - what's needed is a way of using standard non-query string URLs to serve dynamic content.

    There are ways of doing this using Apache rewrite rules - it's possible to tell Apache to send all requests within a certain directory to a specific script (using ScriptAlias) - however this is pretty tricky to do unless you're a bit of an Apache guru.

    Here's the alternative solution:

    Have a look at http://www.tfc-central.co.uk/info.ph...y/name_george/

    The script that is executed is info.php - Zeus (although Apache will do this as well) has realised that there is no file at the specified URL so has worked back until it found a script that it can run - in this case info.php

    Now scroll down the page and check out the server vars - in particular these two:

    HTTP_SERVER_VARS["PATH_INFO"] /info.php
    HTTP_SERVER_VARS["REQUEST_URI"] /info.php/species_monkey/name_george/

    Subtract one from the other and you're left with

    /species_monkey/name_george/

    Split that up using a simple explode function and it's not hard to redefine it as:

    $species = "monkey";
    $name = "george";

    And there you have it - a search engine friendly URL that can still pass variables to a script.

    Cheers,

    Skunk
    More info: http://www.sitepointforums.com/showt...threadid=15798

  3. #3
    SitePoint Wizard holmescreek's Avatar
    Join Date
    Mar 2001
    Location
    Northwest Florida
    Posts
    1,707
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Is this what you mean, Skunk?

    Skunk,

    I understand what you are getting at. So basically, you are
    saying that since the ? is removed a search engine would process the url and when the engine does the http:// on it it would actually index the results generated by the php file?


    Is this right?

    Thanks! - Good info.

  4. #4
    SitePoint Columnist Skunk's Avatar
    Join Date
    Jan 2001
    Location
    Lawrence, Kansas
    Posts
    2,066
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yup - as far as search engine spiders are concerned each page with a URL like that is a normal HTML page, so they'll index them all just fine without ever knowing they are dynamically generated from a database.

  5. #5
    SitePoint Wizard holmescreek's Avatar
    Join Date
    Mar 2001
    Location
    Northwest Florida
    Posts
    1,707
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Great

    Excellent. Thanks for helping, Skunk.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •