The Moz Q&A Forum

    • Forum
    • Questions
    • My Q&A
    • Users
    • Ask the Community

    Welcome to the Q&A Forum

    Browse the forum for helpful insights and fresh discussions about all things SEO.

    1. SEO and Digital Marketing Q&A Forum
    2. Categories
    3. Technical SEO Issues
    4. Writing of url query strings to be seo frinedly

    Writing of url query strings to be seo frinedly

    Technical SEO Issues
    2 2 2.0k
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as question
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • claudeSteyn
      claudeSteyn last edited by

      I understand the basic concepts of url write and creating inbound and outbound rules. I understand the creating of rules to rewrite url query strings so that it’s readable and seo friendly. It’s simple when dealing with a small number of pages and database records.

      (Microsoft Server, asp.net 4.0, IIS 7)

      However, I need to understand the concept to handle this:

      Viz the following:

      • We have a database of 10,000+ establishments, 650+ cities, 400+ suburbs.
      • Each establishment can be searched for by country, province, city and suburb.
      • The search results show establishments that match the search criteria.
      • Each establishment has its own unique id.
      • Each establishment in the search results table has a link to the establishments detailed profile aspx page.
      • The link is a query string such as http://www.ubuntustay.com/detailed.aspx?id=4 which opens the establishments profile.

      We need to rewrite the url to be something like: http://www.ubuntustay.com/detailed.aspx/capetown/westerncape/capetown/campsbay/diamondhouse which should still open the same establishment profile as the above query string.

      I can manually create a rule for this one example above without a problem.

      But there are over 10,000 establishments, all in different provinces, cities and suburbs. Surely we don’t manually generate a rewrite rule for each establishment? The resulting .htaccess will be rather large(?!)

      Therefore my questions are:

      How do I create url rewrite rules for dynamic query strings that originate from a large dataset?

      How do I translate the id number into the equivalent <country>/<province>/<city>/<suburb>/ <establishment>syntax?</establishment></suburb></city></province></country>

      Do I have to wire-up the global.asax so that every incoming requests extracts the country, province, city and suburb based on the establishment id which seem a bit cumbersome(?).

      If you’re wondering how I currently do it (it works but it’s not very portable or efficient):

      For each establishment which is included on the search results I simply construct the link url as: http://www.ubuntustay.com/detailed.aspx/4/Diamond%20House/Camps%20Bay/Cape%20Town

      On the detailed.aspx page load I simply extract the record id (4 in the example above) from the querystring and select that record from the db.

      Claude, what I’m looking for is advice on the best approach on how to create these rewrite rules and would be grateful if you can have one of your SEO friends lend their advice and experience. Any web resources that show the above techniques would be great. I’m not really looking for simple web links to url rewriting overviews…I have plenty of those. It’s the detail on the specific requirement above that I need please.

      1 Reply Last reply Reply Quote 0
      • smarties954
        smarties954 last edited by

        It's not too hard to do in .net. Since .net 3.5, Routing has been added to webforms and is native to MVC.

        Basically, this will allow you to "rewrite", thus create friendly url such as

        www.123.com/florida/miami/city-detail/

        You can map your url so your pages understand wich section is city, state etc... so you can query your database.

        Here is an article about routing in .net:

        http://weblogs.asp.net/scottgu/archive/2009/10/13/url-routing-with-asp-net-4-web-forms-vs-2010-and-net-4-0-series.aspx

        Note: Keep the url in lower case and replace spaces with a dash this way (Cap Cod > cap-cod)

        In our case, this page uses routing actually, I left the .aspx cause I don't care much about it, but this way our entire catalog is written in 2 pages and it pulls the cat and subcats from the url itself:

        http://www.smartresolution.com/printing/envelopes/10-envelopes.aspx

        Here: envelopes = category and 10-envelopes=subcategory. The .aspx can be dropped too if you are picky

        All you have to do in your application is find a pattern and you should able to handle the rewrite in no time and with little code.

        Note, don't forget to redirect (301) the old pages to the new url as well

        1 Reply Last reply Reply Quote 1
        • 1 / 1
        • First post
          Last post
        • Problem with regional URL. From regional to international SEO. I need to change the URL
          sara.biowatch
          sara.biowatch
          0
          6
          64

        • Query string parameters always bad for SEO?
          Martijn_Scheijbeler
          Martijn_Scheijbeler
          0
          7
          7.4k

        • Will using query string in the URL and swapping H1s for filtered view of the blog impact SEO negatively?
          KristinaKledzik
          KristinaKledzik
          0
          3
          63

        • Friendly URLS (SEO urls)
          irvingw
          irvingw
          0
          5
          217

        • SEO URLs?
          Reis_Inc.
          Reis_Inc.
          0
          3
          176

        • No indexing url including query string with Robots txt
          HMK-NL
          HMK-NL
          0
          7
          19.2k

        • URL query strings and canonical tag
          bizarro1000
          bizarro1000
          0
          3
          6.5k

        • Rel canonical with index follow on query string URLs
          panini
          panini
          0
          4
          1.4k

        Get started with Moz Pro!

        Unlock the power of advanced SEO tools and data-driven insights.

        Start my free trial
        Products
        • Moz Pro
        • Moz Local
        • Moz API
        • Moz Data
        • STAT
        • Product Updates
        Moz Solutions
        • SMB Solutions
        • Agency Solutions
        • Enterprise Solutions
        • Digital Marketers
        Free SEO Tools
        • Domain Authority Checker
        • Link Explorer
        • Keyword Explorer
        • Competitive Research
        • Brand Authority Checker
        • Local Citation Checker
        • MozBar Extension
        • MozCast
        Resources
        • Blog
        • SEO Learning Center
        • Help Hub
        • Beginner's Guide to SEO
        • How-to Guides
        • Moz Academy
        • API Docs
        About Moz
        • About
        • Team
        • Careers
        • Contact
        Why Moz
        • Case Studies
        • Testimonials
        Get Involved
        • Become an Affiliate
        • MozCon
        • Webinars
        • Practical Marketer Series
        • MozPod
        Connect with us

        Contact the Help team

        Join our newsletter
        Moz logo
        © 2021 - 2026 SEOMoz, Inc., a Ziff Davis company. All rights reserved. Moz is a registered trademark of SEOMoz, Inc.
        • Accessibility
        • Terms of Use
        • Privacy