I am building a product catalog for a customer website under ASP.NET using .NET Framework 3.5 SP1. Each product has a part number and an OEM part number (all globally unique).
For SEO purposes I would like the OEM part number to be as close as possible to the actual domain name.
How do I build a routing rule that allows me to do this:
http://www.myDomain.com/oemPartNumber
http://www.myDomain.com/myPartNumber
while still being able to do this:
http://www.myDomain.com/welcome
http://www.myDomain.com/products
http://www.myDomain.com/services
http://www.myDomain.com/contact
I would also love to hear your other SEO suggestions (we are primarily interested in Google) if you have any.
Thanks.
IMPORTANT: This not an MVC site, so I don’t have controllers.
You should be able to specify something like http://www.mydomain.com/oempartnumber/oem and http://www.mydomain.com/mypartnumber/pn. There must be something in the url that allows you to choose the controller you want to use and further more allow you to distinguish between a part number and an oem part number (unless those are also unique against one another. If there will never be overlap between oem and pn then you could have http://www.mydomain.com/{partnumber}/pn.
You could use some trickery with a route like this:
But the problem here is that an OEM part number that is not actually a part number (such as “ave-345”) would not match!
UPDATE: In reading I noticed that you said “this is not an MVC site so I don’t have controllers!”…OH! That changes things. In that case you can check to see if the directory exists where you pass in http://www.mydomain.com/1234 and if not you can test it for a product number. This would have to be done in a HttpModule though so you can catch it before your page is executed. Then on the server side you can direct the page to http://www.domain.com/productdetails?pid=1234.
Take a look here to understand that: http://www.15seconds.com/Issue/020417.htm
For this you will have a class that inherits from IHttpModule. Then you can specify an Init method
This then points to your Applicaton_OnAfterProcess method:
private void Application_OnAfterProcess(object source, EventArgs e)
Inside of here you can specify some rules about what you are looking for.
I usually do something along the lines of
Once you isolate your product ID you can then rewrite the URL (server side) and direct the user to the proper productDetails.aspx page.
So while the user and google sees http://www.mydomain.com/1234 your application will see http://www.mydomain.com/products/productdetails.aspx?productid=1234 and you can code against it as usual.
I hope this is what you were looking for instead!