473,414 Members | 1,928 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

Advanced redirect

In the transition of a website from one domain to another for exmaple
from www.oldsite.com to www.newsite.com I need to "rewrite" the URL so
all links to the old site will be linked to the new site as follows:
1. For URLs that reference pages:
Change http://www.oldsite.com/dir1/content/...aspx?p1=1&p2=2
into http://www.newsite.com/dir1/content/...aspx?p1=1&p2=2
2. For URLs that reference sub domains:
Change http://subdomain.oldsite.com to http://subdomain.newsite.com
3. For URLs that reference sub folders
change http://www.oldsite.com/sub1
to http://www.newsite.com/sub1
How can it be done?
If it can be done with RewritePath method of HTTPContext, can someone
show me simple code?
Thanks

Aug 13 '07 #1
4 1460
Find & Replace?
"myalo" <my****@gmail.comwrote in message
news:11**********************@i38g2000prf.googlegr oups.com...
In the transition of a website from one domain to another for exmaple
from www.oldsite.com to www.newsite.com I need to "rewrite" the URL so
all links to the old site will be linked to the new site as follows:
1. For URLs that reference pages:
Change http://www.oldsite.com/dir1/content/...aspx?p1=1&p2=2
into http://www.newsite.com/dir1/content/...aspx?p1=1&p2=2
2. For URLs that reference sub domains:
Change http://subdomain.oldsite.com to http://subdomain.newsite.com
3. For URLs that reference sub folders
change http://www.oldsite.com/sub1
to http://www.newsite.com/sub1
How can it be done?
If it can be done with RewritePath method of HTTPContext, can someone
show me simple code?
Thanks

Aug 13 '07 #2
On Aug 12, 10:07 pm, "Scott M." <s-...@nospam.nospamwrote:
Find & Replace?
I tested that and could not get it work. As I understand (unless I am
missing something here) HTTPContext.RewritePath can change the
"internal path" only such as http://www.oldsite.com/product1 to
http://www.oldsite.com/products.aspx?id=1. It cannot change it to
http://www.newsite.com/product1. Is there a way to change the URL
itself and not only the internal path?
I can use redirect but that gets tricky. When I tried it I got into a
loop as the redirection triggered the handler again and again. I might
be doing something wrong.
Do you have any idea how can do that?
Thanks
Moshe

Aug 13 '07 #3
The RewritePath only works within application. You can not rewrite path to
different URL than the one that is "belongs" to the application.

Hence you can not Rewrite it to different domain name. Response.Redirect
should work just fine.
Why do you redirect to the http://www.newsite.com/product1

Your newsite.com should do the Rewrite to /products.aspx?id=1
George.
"myalo" <my****@gmail.comwrote in message
news:11**********************@j4g2000prf.googlegro ups.com...
On Aug 12, 10:07 pm, "Scott M." <s-...@nospam.nospamwrote:
>Find & Replace?
I tested that and could not get it work. As I understand (unless I am
missing something here) HTTPContext.RewritePath can change the
"internal path" only such as http://www.oldsite.com/product1 to
http://www.oldsite.com/products.aspx?id=1. It cannot change it to
http://www.newsite.com/product1. Is there a way to change the URL
itself and not only the internal path?
I can use redirect but that gets tricky. When I tried it I got into a
loop as the redirection triggered the handler again and again. I might
be doing something wrong.
Do you have any idea how can do that?
Thanks
Moshe

Aug 13 '07 #4

"myalo" <my****@gmail.comwrote in message
news:11**********************@j4g2000prf.googlegro ups.com...
On Aug 12, 10:07 pm, "Scott M." <s-...@nospam.nospamwrote:
>Find & Replace?
I tested that and could not get it work. As I understand (unless I am
missing something here) HTTPContext.RewritePath can change the
"internal path" only such as http://www.oldsite.com/product1 to
http://www.oldsite.com/products.aspx?id=1. It cannot change it to
http://www.newsite.com/product1. Is there a way to change the URL
itself and not only the internal path?
I can use redirect but that gets tricky. When I tried it I got into a
loop as the redirection triggered the handler again and again. I might
be doing something wrong.
Do you have any idea how can do that?
Thanks
Moshe

I say again... Find & Replace?
Aug 14 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Bob Garbados | last post by:
forgive my ignorance, as I'm new to php coming from a ms background... If I create a page named redirect.php and it's only content is: <?php header("Location: http://www.google.com"); ?>...
0
by: Michael J. Wendell | last post by:
Hello, I am trying to debug an issue with sessions in my ASP 3.0 web application, which runs fine on WIN2K Pro and WINXP Pro, yet fails to function correctly on WIN2K Advanced Server. My actual...
7
by: Donna Hawkins | last post by:
I want to use javascript to redirect to a URL which has been passed as a variable (in php). I have searched but cannot find any solution. I think this code is a basic redirect: <script...
4
by: Nhmiller | last post by:
This is directly from Access' Help: "About designing a query When you open a query in Design view, or open a form, report, or datasheet and show the Advanced Filter/Sort window (Advanced...
3
by: Justin | last post by:
Hi, Im confused here over the usage of Response.Redirect and Server.Transfer. I used frameset for my work, what are the proper usages of the two methods that seems working similar.. The...
6
by: Peter Row | last post by:
Hi, I am writing a DLL in VB.NET that implements IHttpHandler.ProcessRequest. This code calls a sub and I need to know if that sub did a response redirect or not. Specifically I need to know...
2
by: Daniel Walzenbach | last post by:
Hi, I have a question regarding the DataGrid control. If paging is enabled the grid binds the data, sets the paging on the top/bottom (or however it is set up) and throws away unnecessary...
5
by: venner | last post by:
I'm having an issue with an ASP.NET website after upgrading to ASP.NET 2.0. The website makes use of a central authentication service (CAS) provided at the university I work for. Each page checks...
10
by: Eirik Eldorsen | last post by:
How can I 301 redirect www.example.com/default.aspx to www.example.com without using ISAPI filters?
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.