Dotnetplace.com

.NET Articles, Web Devploment, ASP.NET, HTML, Sharepoint 2010, Aamir Hasan
Advertise Here
Advertise Here
Advertise Here
Advertise Here
Advertise Here
Advertise Here
Advertise Here
Advertise Here
Advertise Here

Advertise

Loading...


Posted by Aamir Hasan   on Thursday, October 6, 2011 Total Views:  


Sometimes we forgot to see the basic need of SEO and find canonical URL issue of our sites when search engine fetch our site same page in both upper and lowercase URLs result. Let’s take my site example to resolve this issue. I have built my site named www.dotnetplace.com in ASP.NET 4.O and is running under IIS6 & IIS7.

In this article, I will make obvious how to handle canonical URL issue in asp.net page. Upper case letter in the URL will not negative effect in your page rank in the search engines. But, duplicate content displaying in the Search engine with same URL have cap and no caps. For example, Google search http://www.dotnetplace.com/default.aspx and http://www.dotnetplace.com/Default.aspx pages. Now, Google will be considered that these are two pages. Google will not ignore upper case and lower case letter in the domain. When I was working, I have found in my search that URL’s are not case sensitive. You can load same pages name with upper case and lower case letter in URL, it will display you same content as shown below.

·         http://www.dotnetplace.com/Default.aspx

·         http://www.dotnetplace.com/default.aspx

Above links with uppercase and lowercase URLs return same page with same content and information. But search engine considers that these are two different pages and search rank has been evaporating rapidly.


To resolve this problem, I have implemented 301 redirects, which automatically converts URL into lower case to fix the search engine ranking.

Add following code into your Global.asax file.
 

    protected void Application_BeginRequest(object sender, EventArgs e)

    {

        if (Regex.IsMatch(HttpContext.Current.Request.RawUrl.ToString(), @"[A-Z]"))

        {

            string LowercaseURL = HttpContext.Current.Request.RawUrl.ToString().ToLower();

            Response.Clear();

            Response.Status = "301 Moved Permanently";

            Response.AddHeader("Location", LowercaseURL);

            Response.End();

        }

    }

 

Note: If someone writes, upper case in URL then it will be converted into lower case. 

Protected by Copyscape Online Plagiarism Tool

Comments (5) -

Chantay Strictland
Chantay Strictland United States
6/28/2015 12:26:04 PM #

I got this web site from my pal who informed me on the topic of this web site and at the moment this time I am browsing this web site and reading very informative content at this time.|

Dexter Barlau
Dexter Barlau United States
7/7/2015 10:07:20 PM #

I have been browsing online more than 2 hours today, yet I never found any interesting article like yours. It's pretty worth enough for me. Personally, if all webmasters and bloggers made good content as you did, the net will be much more useful than ever before.|

Guadalupe Hsueh
Guadalupe Hsueh United States
7/9/2015 1:02:41 AM #

I'll right away seize your rss feed as I can not find your e-mail subscription link or e-newsletter service. Do you've any? Kindly allow me understand so that I could subscribe. Thanks.|

copywriting as a job
copywriting as a job United States
10/11/2015 6:43:17 AM #

Insightful! Appealing! Quality! Prized possession! Fabulous! Great! Remarkable! Just all the great words apply to this material! If you maintain up the good work, thank you from the bottom of my heart as well as soul and I will come browse through once again!

buy backlinks
buy backlinks United States
10/23/2015 4:15:14 AM #

Useful! Intriguing! Quality! Valuable! Legendary! Wonderful! Remarkable! Just all the good words apply to this content! Thanks from the bottom of my body and soul as well as I will come see once more if you maintain the good work!

link building packages
link building packages United States
10/28/2015 4:39:42 AM #

Just spectacular! I understand you have placed a great deal of effort right into this as well as I desired to tell you exactly how grateful I am! Hope you put out even more incredible stuff in the close to future and also I will come back and also review it!

new invention ideas
new invention ideas United States
5/26/2017 11:59:14 PM #

You made some good points there. I checked on the net for more info about the issue and found most individuals will go along with your views on this web site.

patent an invention
patent an invention United States
5/30/2017 11:21:25 PM #

Good post. I will be experiencing some of these issues as well..

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

Advertizement 1
Advertizement 2
Advertizement 3
Advertizement 4
Advertizement 5