Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

URL Rewrite Issue

Status
Not open for further replies.

bernie321

Programmer
Jan 7, 2004
477
GB
Hi

We have a domain that is hosted on a shared server (so no access to IIS etc if relevent), the domain is currently in a root folder but now there is a need to change this so that the domain is in a sub folder accessed by domain/folder/page, due to changes by the host (don't ask why! I will be changing the host when I have time, but currently I am trying to sort a solution)

However I am keen not to loose the searchengine links and rankings hence url re-writing.

So I have the code below which appears to be ok at remapping the paths.

My only final concern is that when the user types domain.com they will hit the root folder, which then through a default.asp script redirect them to domain.com/folder/default.aspx, but how can show the url as "domain.com/default.aspx"?

Thanks in advance
B

Dim fullOrigionalpath As String = Request.Url.ToString()

If InStr(fullOrigionalpath.ToLower, "mydomain/folder/") = False Then

Context.RewritePath("/folder" & fullOrigionalpath.ToLower)

'ElseIf
'code here required if the URL is "mydomain/folder"

End If
 
I think what you need is Server.Transfer...

Hope this helps...
 
Hi Mmaz

thanks for your post.

Unfortunately the originating page (in the root folder) is an ASP page and the page it is redirecting to is ASPX.

I understand that you cannot server.transfer from asp to aspx?

Thanks
B
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top