2

For example, if the user input the url like "http://site.com/controller.php", I want it has the same result as he input "http://site.com/controller".

List of examples with equivalent url:

 1. /controller.php             <->  /controller
 2. /controller/action.html     <->  /controller/action
 3. /controller/action.asp      <->  /controller/action
 4. /controller/action/id.aspx  <->  /controller/action/id

Is there an elegant way to achieve it?

Yad Smood
  • 2,752
  • 2
  • 24
  • 37
  • Just found a similar question. THere are several suggested solutions: http://stackoverflow.com/questions/4449449/asp-net-mvc-to-ignore-html-at-the-end-of-all-url – Giscard Biamby Feb 12 '12 at 04:18

1 Answers1

0

Perhaps try the IIS Rewrite module? Probably a single rule would accomplish this. If you don't want redirects you'd have to have web.config handler settings for .php, and also update all your routes to account for .php version of your assemblies.

I would just use IIS Rewrite to do 301 redirects, because it would help keep search engine ranking for the identical pages unified at one URL.

Giscard Biamby
  • 4,569
  • 1
  • 22
  • 24