Very strange URL rewrite problem?
I am rewriting the url http://www.tworiverstaines.co.uk to http://www.tworiverstaines.co.uk/TwoRivers/
When the site first loads the rewrite works correctly displaying Default.aspx with all the hyperlinks working correctly including the path to the App_Themes folder etc.
However when you click on the homepage link (or any other) when the Default.aspx (or page requested) loads all the hyperlinks and paths are altered from /Default.aspx to /TwoRivers/Default.aspx so when you click on a hyperlink it is broken as the rewrite rule will take you to www.tworiverstaines.co.uk/TwoRivers/TwoRivers/Default.aspx.
To prevent the 404 error I have added a local rule to rewrite /TwoRivers/TwoRivers/ to /TwoRivers/ however this isn't a good solution as the URL in the browser shows the subfolder and pages b开发者_运维知识库ecome available at /Default.aspx and /TwoRivers/Default.aspx which could present duplicate content issues with search engines.
Does anyone have any idea why this is happening?
The site can be accessed at http://www.tworiverstaines.co.uk
I am displaying the header information at the bottom of each page to display the paths.
This is because of your action attribute in your form tag. Do you rewrite that form tag also?
On the Page http://www.tworiverstaines.co.uk/Default.aspx you action attribute contains
<form name="aspnetForm" method="post" action="TwoRivers/Default.aspx" id="aspnetForm">
if not, here is a solution:
http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx
go down to "Handling ASP.NET PostBacks with URL Rewriting"
精彩评论