PHP urls with variable data in search engine results

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • phpkid

    #1

    PHP urls with variable data in search engine results

    Howdy
    I've been given conflicting answers about search engines picking up
    urls like: http://mysite.com/index.php?var1=1&var2=2&var3=3
    Do search engines pick up these urls?
    I've been considering converting a site of mine to PHP-Nuke, but if
    the individual modules aren't picked up in search engines I'm not
    going to do it.
    Thanks
    phpKid
  • Roger Smith

    #2
    Re: PHP urls with variable data in search engine results

    > I've been given conflicting answers about search engines picking up[color=blue]
    > urls like: http://mysite.com/index.php?var1=1&var2=2&var3=3
    > Do search engines pick up these urls?[/color]

    For the most part, Google is the only search engine that counts. :-)

    Google seems to be okay with URLs like that - as long as it finds the URL
    within a site, it'll follow it and index it. Of course, you don't want
    something like an ID in the that will change with each session. The URL
    should always be the same for the same page.

    To make the URLs shorter and to make it more likely that search engines will
    index the page, you might do something like I'm doing with most of my pages.

    I use Apache's Rewrite directive to shorten the URLs and make them look like
    normal .html. For example, I have the following in my .htaccess file:

    RewriteEngine on
    RewriteRule ^news-(.*)-(.*)\.html$
    index.php?nilss on=1&action=HOM E&subaction=DIS PLAY&detail=$1& articleref=$2

    This makes the following URL:

    Find news, music, photos and more at the official site for Harry Nilsson, the singer-songwriter known for the hits Without You, Coconut and Everybody's Talkin'


    do the same as:




    Another trick you can use is to add "AcceptPath Info On" to the .htaccess
    file. Then you can use a URL like:

    Find news, music, photos and more at the official site for Harry Nilsson, the singer-songwriter known for the hits Without You, Coconut and Everybody's Talkin'


    Inside your php code, $_SERVER [ 'PATH_INFO' ] will be set to
    "/home/display/48/24269". You can "explode" it into the individual
    parameters:

    list($action, $subaction, $detail, $articleref) = explode("/",
    $_SERVER['PATH_INFO']);

    I prefer the first method even though it requires editing the .htaccess file
    for different sets of parameters. I don't have any good reason for
    prefering the method other than that the URLs look more like regular HTML
    pages.

    -- Roger
    Harry Nilsson's "The Point!" on DVD
    Find news, music, photos and more at the official site for Harry Nilsson, the singer-songwriter known for the hits Without You, Coconut and Everybody's Talkin'



    Comment

    Working...