SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Hybrid View

  1. #1
    E-business guru Eirik's Avatar
    Join Date
    Nov 2000
    Location
    Oslo, Norway
    Posts
    413
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    This is probably one of those typical newbie questions, and I hate when there's something I'm a newbie at, but I just have to ask..

    How will search engines treat PHP scripts? Cause I'm thinking say I have a PHP script that serves all the articles at my site. With this being a lot of articles, naturally I would want the search engines to spider them all uniquely. So I'm wondering if a search engine that is told spider an URL like mysite.com/article.php?id=1 will spider the content of article 1 or the content of the PHP script. Likewise, will it recognize the different content in article 2 located at mysite.com/article.php?id=2 and so on?

    Thanks in advance !
    Sincerely,

    Eirik Johansen
    Netmaking AS

  2. #2
    SitePoint Member The_tick's Avatar
    Join Date
    Feb 2001
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if the dynamic pages have links to them they all should get listed.
    http://v-sector.com - Webhosting $7.95
    http://v-resources.com - Free Webmaster Resources
    http://v-redirect.com - Free URL Redirection

  3. #3
    E-business guru Eirik's Avatar
    Join Date
    Nov 2000
    Location
    Oslo, Norway
    Posts
    413
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm not following you. Which dynamic page, and where should the links point?

    Thanks !

  4. #4
    Serial Publisher silver trophy aspen's Avatar
    Join Date
    Aug 1999
    Location
    East Lansing, MI USA
    Posts
    12,937
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Most search engines (barring google) with not index any page with a URL that contains a ? or a &
    Chris Beasley - I publish content and ecommerce sites.
    Featured Article: Free Comprehensive SEO Guide
    My Guide to Building a Successful Website
    My Blog|My Webmaster Forums

  5. #5
    E-business guru Eirik's Avatar
    Join Date
    Nov 2000
    Location
    Oslo, Norway
    Posts
    413
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi guys,

    So, is there any way around this problem? It must be pretty common (or at least starting to be).
    Sincerely,

    Eirik Johansen
    Netmaking AS

  6. #6
    SitePoint Wizard silver trophy Karl's Avatar
    Join Date
    Jul 1999
    Location
    Derbyshire, UK
    Posts
    4,411
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The way most people do it is to pass the variables to the page using article.php/aid etc. then parsing the URL for the variables.

    Another way is to have a file called article that is parsed as PHP then use domain.com/article/aid

    They both work in the same way but the 2nd one looks better.
    Karl Austin :: Profile :: KDA Web Services Ltd.
    Business Web Hosting :: Managed Dedicated Hosting
    Call 0800 542 9764 today and ask how we can help your business grow.

  7. #7
    imagine no limitations exbabylon's Avatar
    Join Date
    Dec 2000
    Location
    Idaho, USA
    Posts
    452
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    as has already been reiterated, most search engines (Save Google and Yahoo, which is also Google based) don't index stuff like foo.php?foo=1&table=4

    However, do not be afraid, there is a very easy way around this. This method works great, but to cut down on confusion and flustration you may want to limit the ammount of variables you pass on in the URL to two or at the outside three.

    if you show all your articles titles with a while statement that currently is something like this:
    Code:
    if($id != ""){
    
    $sql = "SELECT * FROM table WHERE id='$id'";
    $result = mysql_query($sql);
    while($row = mysql_fetch_array($result)){
        echo("$row['title']<br><blockhead>$row['content']</blockhead><br>">
    }
    } else{
    $sql = "SELECT * FROM table";
    $result = mysql_query($sql);
    
    while($row = mysql_fetch_array($result)){
    echo("<a href=\"$PHP_SELF?id=$row['id']\">$row['title']</a>");
    }
    }
    then you will have a problem with the search engines...

    however, using a simple change in your code, and an explode function you can make them search engine friendly.

    Code:
    $get_vars = explode("/",$PATH_INFO); 
    $id=$url_array[1];
    
    if($id != ""){
    
    $sql = "SELECT * FROM table WHERE id='$id'";
    $result = mysql_query($sql);
    while($row = mysql_fetch_array($result)){
        echo("$row['title']<br><blockhead>$row['content']</blockhead><br>">
    }
    } else{
    $sql = "SELECT * FROM table";
    $result = mysql_query($sql);
    
    while($row = mysql_fetch_array($result)){
    echo("<a href=\"$PHP_SELF/$row['id']\">$row['title']</a>");
    }
    }
    notice the change.

    I made all your links go to foo.php/1 instead of foo.php?id=1. I used an explode function at the top of the page to parse the URL... and everything with a / after your script brings back an array. You could have thirty or more this way, but it could be a pain. This method can be altered easily to fit into whatever application you want it to.

    For more details and discussion on this go here:

    http://sitepointforums.com/showthrea...threadid=15798

    God Bless
    Blamestorming: Sitting around in a group discussing why a deadline was missed or a project failed and who was responsible.

    Exbabylon- Professional Internet Services


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
  •