echoEMC2
asked on
adding a trailing slash in asp.net url - url rewrite
Hello, we're trying to add a trailing slash in a url of a website coded in asp.net IIS 7
right now the webpage is:
.com/leads.html
we want to change it to:
.com/leads/
the only thing we can do know w/ IIS rewrite is change it to:
.com/leads
do you have any suggestions? Thanks for any help...
right now the webpage is:
.com/leads.html
we want to change it to:
.com/leads/
the only thing we can do know w/ IIS rewrite is change it to:
.com/leads
do you have any suggestions? Thanks for any help...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I use URLReWriter, it is easy and free
a rule as yours would be:
<rewrite url="~/Public/Thankyou" to="~/Public/Thankyou.aspx " processing="stop"/>
a rule as yours would be:
<rewrite url="~/Public/Thankyou" to="~/Public/Thankyou.aspx
ASKER
Hey guys, sorry I forgot to mention we are using asp.net mvc 2
Any suggestions since it's asp.net mvc 2? Thanks.
Any suggestions since it's asp.net mvc 2? Thanks.
see the following url
http://weblogs.asp.net/scottgu/archive/2007/12/03/asp-net-mvc-framework-part-2-url-routing.aspx
it handles routing in the controller.
http://weblogs.asp.net/scottgu/archive/2007/12/03/asp-net-mvc-framework-part-2-url-routing.aspx
it handles routing in the controller.
below is a link talking about using routing instead of url rewriting
http://chriscavanagh.wordpress.com/2008/03/11/aspnet-routing-goodbye-url-rewriting/
http://chriscavanagh.wordpress.com/2008/03/11/aspnet-routing-goodbye-url-rewriting/
ASKER
The solution was to use the url rewrite module for iis 7 as this url says: http://weblogs.asp.net/scottgu/archive/2010/04/20/tip-trick-fix-common-seo-problems-using-the-url-rewrite-extension.aspx
Then, you need to create a new helper instead of using the default Url.Route(), like a Url.RouteTrailingSlash() that adds a "/" at the end of the urls.
Then, you need to create a new helper instead of using the default Url.Route(), like a Url.RouteTrailingSlash() that adds a "/" at the end of the urls.
move leads.html to be in the folder leads
rename leads.html into index.html
point your browser to .com/leads/
you are done