Download c# code
What is URL REWRITING?
URL rewriting is the process of intercepting an incoming Web request and redirecting the request to a different resource. When performing URL rewriting, typically the URL being requested is checked and, based on its value, the request is redirected to a different URL. For example, in the case where a website restructuring caused all of the Web pages in the /people/ directory to be moved to a /info/employees/ directory, you would want to use URL rewriting to check if a Web request was intended for a file in the /people/ directory. If the request was for a file in the /people/ directory, you'd want to automatically redirect the request to the same file, but in the /info/employees/ directory instead.
Common Uses of URL Rewriting
Creating data-driven ASP.NET websites often results in a single Web page that displays a subset of the database's data based on querystring parameters. For example, in designing an e-commerce site, one of your tasks would be to allow users to browse through the products for sale. To facilitate this, you might create a page called displayproduct.aspx that would display the products for a given category. The category's products to view would be specified by a querystring parameter. That is, if the user wanted to browse the Widgets for sale and all Widgets had a CategoryID of 5, the user would visit:
There are two downsides to creating a website with such URLs. First, from the end user's perspective, the URL http://yousite.com/displayCategory.aspx?CategoryID=5 is a mess. But for user we have to choose URL’s that:
- Are short.
- Are easy to type.
- Visualize the site structure.
- "Hackable," allowing the user to navigate through the site by hacking off parts of the URL.
- Are easy to remember
A better approach is to allow for a sensible, memorable URL, such as http://yoursite.com/products/Books. By just looking at the URL you can find what will be displayed—information about Books. The URL is easy to remember and share, too. you can tell to anybody, "Check out yoursite.com/products/books," and he'll likely be able to bring up the page without needing to ask what the URL was. (Try doing that with, say, an http://login.live.com/?id=1 page!) The URL also appears, and should behave, "hackable." That is, if the user hacks of the end of the URL, and types in http://yoursite.com/products, they should see a listing of all products, or at least a listing of all categories of products they can view
For example http://login.live.com/?id=1 the view of the page is different and if you enter http://login.live.com/?id=2 or http://login.live.com/?id=3 the behavior is different.
What Happens When a Request Reaches IIS
Before we examine exactly how to implement URL rewriting, it's important that we have an understanding of how incoming requests are handled by Microsoft® Internet Information Services (IIS). When a request arrives at an IIS Web server, IIS examines the requested file's extension to determine how handle the request. Requests can be handled natively by IIS—as are HTML pages, images, and other static content—or IIS can route the request to an ISAPI extension. (An ISAPI extension is an unmanaged, compiled class that handles an incoming Web request. Its task is to generate the content for the requested resource.)
For example, if a request comes in for a Web page named Info.asp, IIS will route the message to the asp.dll ISAPI extension. This ISAPI extension will then load the requested ASP page, execute it, and return its rendered HTML to IIS, which will then send it back to the requesting client. For ASP.NET pages, IIS routes the message to the aspnet_isapi.dll ISAPI extension. The aspnet_isapi.dll ISAPI extension then hands off processing to the managed ASP.NET worker process, which processes the request, returning the ASP.NET Web page's rendered HTML.
What is SEO
Search engine optimization (SEO) is the process of improving the volume and quality of traffic to a web site from search engines via "natural" ("organic" or "algorithmic") search results for targeted keywords. Usually, the earlier a site is presented in the search results or the higher it "ranks", the more searchers will visit that site. SEO can also target different kinds of search, including image search, local search, and industry-specific vertical search engines.
As a marketing strategy for increasing a site's relevance, SEO considers how search algorithms work and what people search for. SEO efforts may involve a site's coding, presentation, and structure, as well as fixing problems that could prevent search engine indexing programs from fully spidering a site.
Static URLs are known to be better than dynamic URLs for a number of reasons:
1. Static URLs typically rank better in search engines.
2. Search engines are known to index the content of dynamic pages much more slowly than that of static pages.
3. Static URLs look friendlier to end users.
Example of a dynamic URL
dynamic URLs into static looking HTML URLs.
Examples of the above dynamic URL re-written:
There are three HTML Tags, which affect ranking; these are Title Tags, Keyword Tags and Description Tags.
Title Tags - HTML Title describes the contents web page. This title is most likely to appear in the results for search engines and on bookmarks, and should be made relevant to the contents on the web page.
Keyword Tags - Keyword frequency, weight, prominence and proximity are a few techniques that can help improve search engine rankings. Most of these techniques have one thing in common - use of keywords. Keywords are words people type into a search engine... words that lead them to site. Having the right keywords in your website's source code in the form of a Meta tag is the first step to better search engine positioning.
Description Tags - Description tags are HTML tags that describe in brief the contents of the page. These are visible to the surfer when your page appears in the results of a search. These can be effectively used to increase the frequency of keywords in the HTML of your web page.
Alt Tags Composition & Upload
ALT tags are basically image descriptions within a website. You can attach text to an image to describe it so that Search Engines can also find it. ALT descriptions help you rank higher in search engines. Search engine algorithms calculate the number of times keywords are repeated and give higher rank to pages that use them often. Keywords in the ALT descriptive text help you increase their frequency on the page. Search engines assume the terms are more relevant and important if they're used in the page content.
META NAME="Description" CONTENT="http://an-it-solution.blogspot.com/”
META NAME="Keywords" CONTENT="http://an-it-solution.blogspot.com/”
Meta Name="abstract" Content="http://an-it-solution.blogspot.com/"
The major task of URL rewriting is to make the URL static and short so, the URL becomes readable, memorable and ranked on search engines.