SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    I solve practical problems. bronze trophy
    Michael Morris's Avatar
    Join Date
    Jan 2008
    Location
    Knoxville TN
    Posts
    2,033
    Mentioned
    65 Post(s)
    Tagged
    0 Thread(s)

    A general warning about Query String rewriting and SEO.

    Several people have in the last few months asked for help with code that parses a URL into a query, like this.

    /www.site.com/param/val/param2/val/param3/val

    As I understand it this is getting done in the hopes of making URI's nice and pretty for SEO purposes. It's also a great way to lose page rank. Here's why.

    First, search engines have no problem parsing query strings. However, query strings aren't seperate pages. Hence

    index.php?page=home
    index.php?page=news
    index.php?page=about

    These are all considered the same page by a search engine, so url rewriting to separate them is advised. The problem is overkill like this.

    category/tshirts/size/m/color/blue/brand/jacki

    In a shopping cart system we can expect to see this sort of thing. The danger is if the parameter order gets switched.

    category/tshirts/color/blue/size/m/brand/jacki
    category/tshirts/brand/jacki/color/blue/size/m

    And so on. Each of these sequences are considered separate pages. When the search engine realizes they are the same page it lowers the ranking of the page for spam.

    When using mod rewrite to allow query strings to be set up in this manner, keep in mind that you must choose an order for the parameters and enforce it to avoid the illusion of duplicate pages and being penalized. And don't be afraid to use query strings. Google knows that

    category/tshirts.php?color=blue&size=m&brand=jacki
    category/tshirts.php?brand=jacki&color=blue&size=m

    are the same page, just with different search parameters, and won't penalize you.

  2. #2
    SitePoint Addict
    Join Date
    Mar 2005
    Posts
    231
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the insight!

  3. #3
    SitePoint Wizard wonshikee's Avatar
    Join Date
    Jan 2007
    Posts
    1,223
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    The solution I use is simply a mix of the two.

    For example.

    /cart/add?p=black-shirt&o=red

    For most pages, it would simply be something like /products, or /contact-us, but to pass parameters in, you'd use the normal query string.

    What michael presents is a very annoying situation where you must follow an exact order and deviations can cause issues due to the coupling of the URI as a request and as a parameter.

  4. #4
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,270
    Mentioned
    60 Post(s)
    Tagged
    3 Thread(s)
    why is this in the php forum?

    i think it belongs elsewhere, as it has much broader scope
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  5. #5
    I solve practical problems. bronze trophy
    Michael Morris's Avatar
    Join Date
    Jan 2008
    Location
    Knoxville TN
    Posts
    2,033
    Mentioned
    65 Post(s)
    Tagged
    0 Thread(s)
    I'm not against moving it, but I posted it here because typically PHP is used with mod_rewrite to perform these sorts of operations and the topic has come up frequently enough in the past 3 months I figured it warranted comment.

  6. #6
    SitePoint Wizard frank1's Avatar
    Join Date
    Oct 2005
    Posts
    1,392
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by r937 View Post
    why is this in the php forum?

    i think it belongs elsewhere, as it has much broader scope
    I wish there were like button here as in facebook. lol (I would have liked this thought)

  7. #7
    From space with love silver trophy
    SpacePhoenix's Avatar
    Join Date
    May 2007
    Location
    Poole, UK
    Posts
    5,032
    Mentioned
    103 Post(s)
    Tagged
    0 Thread(s)
    Thread moved to the Server Configuration, Apache & URL Rewriting forum.

    If your using Apache then you can do re-writes using .htaccess once the rewrite module is enabled by un-commenting the line LoadModule rewrite_module modules/mod_rewrite.so httpd.conf and rebooting once the change has been saved.
    Community Team Advisor
    Forum Guidelines: Posting FAQ Signatures FAQ Self Promotion FAQ
    Help the Mods: What's Fluff? Report Fluff/Spam to a Moderator

  8. #8
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,653
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)

    Thumbs down WRONG!

    MM,

    Your argument if fallacious. When using the path method and redirecting WITHOUT an R=301, the actual script is hidden from the visitor (which includes SE's). When you post something like this, please understand what you're posting so newbies will not get the wrong impression.

    If you doubt me, go to http://wilderness-wally.com and tell me which script is serving all the @#$% articles on the website.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  9. #9
    I solve practical problems. bronze trophy
    Michael Morris's Avatar
    Join Date
    Jan 2008
    Location
    Knoxville TN
    Posts
    2,033
    Mentioned
    65 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by dklynn View Post
    MM,

    Your argument if fallacious. When using the path method and redirecting WITHOUT an R=301, the actual script is hidden from the visitor (which includes SE's).
    The content the script outputs however is NOT so hidden, and if the content matches, or nearly matches, the output of the script for another "page" on the same site, the spider will declare it a spam dupe and lower the page rank of BOTH pages.

    When you post something like this, please understand what you're posting so newbies will not get the wrong impression.
    I do understand what I'm talking about and you sir are the one in error. Lower your bombast please.


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
  •