0

I'm working on an existing large site that uses querystings in ID for different sections (representing physical stores) of the website.

I'd like to be able to implement pathinfo requests for SEO purposes so I'm looking at URLS like:

http://www.domain.com/cooking-classes.aspx?ID=5 (where 5 would be the ID of the local store)

Is there a way to make this type of URL work?

http://www.domain.com/cooking-classes.aspx?ID=5/chocolate ? I can get the content to work without the querystring however the existing infrastructure needs the ID to run. I tried:

http://www.domain.com/cooking-classes.aspx/chocolate?ID=5 however the ID comes back incorrectly.

Using http://www.domain.com/cooking-classes.aspx/5/chocolate means a rewrte of the page handling engine.

Am I clutching at straws here? No real way to get PathInfo and Querystring to play nicely with each other?

I'd like to stay away from any IIS mods as we don't have access.

1
  • If you're using IIS (possibly 7+ only though 6 may also have the ability) you may be able to depend on it to handle the URL rewriting for you. This would eliminate the need for your application to change at all in order to facilitate SEO friendliness. Commented Jan 23, 2012 at 5:35

1 Answer 1

1

Your last URL is going to yield the best result for search engines, however you may want to drop the .aspx. You will need to write an HttpHandler or HttpModule to be able to accomplish this. It's actually not as much work as it may seem, and you don't have to change your page at all. Your HttpHandler can do a behind the scenes redirect preserving the URL. Check out this article on the MSDN:

http://msdn.microsoft.com/en-us/library/ms972974.aspx

If you don't need anything super specific, you could use an existing HttpModule like the one mentioned in the post on ScottGu's blog:

http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx

He mentions UrlRewriter.net which is open source:

http://urlrewriter.net/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.