Reputation: 20001
I am using Intelligenicai.URLRewriter.dll to rewrite my website URL it is working fine i followed the following link as an example
On the other article i read about URL rewrite can create problems for search engines as now we can access same page with two different URL one without URL rewrite and one with URL rewrite. (Check this link http://thecodebug.com/?p=296)
Above mentioned link talks about search engines can penalize if they find duplicate contents on the website. This article (http://thecodebug.com/?p=296) talks about "html canonical link in the header" if we don't add them then we can tell search engine that this url is canonical.
Now my question is this applicable to even if i use Intelligenicai.URLRewriter.dll and if this is the fact what are the precautions i should take to avoid such scenario.
Example of my URL With URL Rewrite http://www.xyz.com/Article/en-US/19/87/let-the-spirit-of-our-nation’s-founders-guide-us.aspx
URL without rewrite http://www.xyz.com/Article/ArticleDetails.aspx?Language=en-US&PageID=19&ArticleID=87
Part of web.config
<rewriter>
<rewrite url="~/Article/(.+)/(.+)/(.+)/(.+).aspx" to="~/ArticleDetails.aspx?Language=$1&PageID=$2&ArticleID=$3" processing="stop"/>
</rewriter>
Upvotes: 1
Views: 982
Reputation: 3766
You can add 2 rules: One rewriting the new-style links to the physical URLs then stop processing rules, and then follow it with a rule to rewrite direct requests to the aspx page to the new style URL, 301 permanent redirect, and stop processing rules. The 301 redirect is important! If you can't get it to do that with your rewriting DLL then you can redirect the URL to a special hidden page that will accept the old page as the querystring or looking at the referrer, then mapping it out to the new page using a 301 redirect there.
UPDATE: Here's some more information:
Using Intelligenica UrlRewriter, you would set up two rules, in this order:
The first rule uses the rule you have already set up for redirecting the fancy URL to the physical file.
The second rule takes the path to the physical file and either (a) 404 or (b) 301 permanent redirects to the fancy URL. If you have a single page serving up multiple pages of content, you may be better off just stopping processing with a 404 error. Also, as long as you never use the old-style links anywhere in your site, you should be okay. If at ANY TIME you used the old style links (before you rewrote the URLs), you definitely need to make sure that you have rewriting set up to redirect or 404 the page so the new style URLs are forced.
<rewriter>
<rewrite url="~/Article/(.+)/(.+)/(.+)/(.+).aspx" to="~/ArticleDetails.aspx?Language=$1&PageID=$2&ArticleID=$3" processing="stop"/><!-- rewrites URL -->
<rewrite url="~/ArticleDetails.aspx?Language=(.+)&PageID=(.+)&ArticleID=(.+)" to="~/Article/$1/$2/$3.aspx" processing="stop" permanent="true" /><!-- Redirects old page to new url with 301 -->
</rewriter>
Hope this helps.
Upvotes: 1