Writing of url query strings to be seo frinedly
-
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.
-
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:
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
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
Folders in url structure?
Hello, Revamping an out-of-date website and am wondering if I need to include the folders (categories) in the url structure? The proposed structure has 8 main folders. I've been reading that Google is ok if the folder is not included in the url, but is it really? The hesitation I have is that the urls are getting long and the main folder only has only a sub folder beneath it. So, /folder-name/facility-name/treatment-overview. This looks too long, doesn't it? Thanks!
Technical SEO | | lfrazer1230 -
SEO URLs: 1\. URLs in my language (Greek, Greeklish or English)? 2\. Αt the end it is good to put -> .html? What is the best way to get great ranking?
Hello all, I must put URLs in my language Greek, Greeklish or in English? And at the end of url it is good to put -> .html? For exampe www.test.com/test/test-test.html ? What is the best way to get great ranking? I am a new digital marketing manager and its my first time who works with a programmer who doesn't know. I need to know as soon as possible, because they want to be "on air" tomorrow! Thank you very much for your help! Regards, Marios
Technical SEO | | marioskal0 -
Usage of keywords in URL
Hi everyone, I'm trying to optimize our website and I'm not sure what's ideal for our URL structure. We have two products: one of them is focused on B2C & the other one on B2B.
Technical SEO | | Klouwers
Our homepage is focused on the B2C product. For our B2B product, I'm not sure what's ideal. The URL for our 'homepage' of the B2B product is ourdomain.com/software. We have different target groups for our B2B software, and therefore different pages on our website. Which URL would be best to use for the keyword personal trainer software?
1. ourdomain.com/software/personal-trainer-software
2. ourdomain.com/software/personal-trainer0 -
Canonical URL on frontpage
I have a site where the CMS system have added a canonical URL on my frontpage, pointing to a subpage on my site. Something like on my domain root.Google is still showing MyDomain.com as the result in the search engines which is good, but can't this approach hurt my ranking? I mean it's basically telling google that my frontpage content is located far down the hierarki, instead of my domain root, which of course have the most authority.
Technical SEO | | EdmondHong87
Something seems to indicate that this could very well be the case, as we lost several placements after moving to this new CMS system a few months ago.0 -
Changing URLs
As of right now we are using yahoo small business, when creating a product you have to declare an id, when we created the site we were not aware that you will not be able to change the id but also the ID is being used as the URL. we have a couple thousand products in which we will need to update the URLs. What would the best way to be to fix this without losing much juice from our current pages. Also I was thinking that if we did them all in a couple weeks it would hurt us a lot, and the best course of action would be to do a slow roll out of the URL changes. Any help is appreciated. Thank you!
Technical SEO | | TITOJAX0 -
Which URL structure holds the best SEO value?
Hello Community! We are rewriting URLs to better rank and provide better visual usability to our visitors. Would it be better to serve a URL that looks like this: www.domain.com/category-subcategory or www.domain.com/category/subcategory Please note the slight difference--the 2nd URL calls out a category that has a subcategory under it. Would it give us more value? Does it make a difference? Thanks in advance!
Technical SEO | | JCorp0 -
Site forwarding - seo friendly or not?
Recently i decided to change my domain name - and although i have written several useful and working .htacess files with 301 redirects, this one became more complicated by the fact that I went through TWO domain name changes, before settling on the second one. Having seen some issues with the browser not being able to interpret correctly the .htaccess file, i temporarily suspended the .htaccess file, and opted instead for site forwarding. I don't know the mechanics behind site forwarding, or whether it is seo friendly or just a method for ip addressing, a sort of pseudo domain name server record change.
Technical SEO | | highersourcesites
I let it lie for a few weeks, until the dust settled, and yesterday put back the basic .htaccess file, with a 301 redirect, which directs the original domain name to be forwarded to the new one ( also it has a conditional in place to solve canonical issues). It works fine. But right now i am not seeing the link juice, the domain age, the domain page rank that it has. It has gone to zero, when it used to be three, sometimes four. I also made the change of address using webmaster tools. How long ( forever?) will it take to see my old page rank come back, even if it loses 10% from the change? And does site forwarding help or hinder seo ranking?0 -
"To keyword or not to keyword" in the URL string?
We are debating on whether to use primary keywords in the URL for every page for a new client for the sake of SEO. What is the feeling in the Community on which version is smarter? Version 1: www.abccompany.com/miami-moving-company/about-us www.abccompany.com/miami-moving-company/contact-us etc. etc. Version 2: www.abccompany.com/about-us Thank you for your thoughts!
Technical SEO | | theideapeople0