What is ur IIS version ?
Main Topics
Browse All TopicsI have hundreds of pages on my site which I am about to remove. However I would prefer to use a 301 redirect to re-direct all these pages to another page on my site (Not necessarily the home page) I dont want to have hundreds of missing pages and loose pagerank.
I know how to redirect one page to another. I would use the following code:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Response.Status = "301 Moved Permanently"
Response.AddHeader("Locati
End Sub
However I dont want to re-code hundreds of pages by removing the old code and adding the above code. I would prefer to perform a 301 redirect for all these pages from a single page/file. Perhaps from the global.aspx or web.config page. That way I could keep the code for the 301 redirects all in one place and not have hundreds of pages.
Please provide the exact code to do the following:
How would I redirect the following pages:
http://www.bargainsonsale.
http://www.bargainsonsale.
http://www.bargainsonsale.
http://www.bargainsonsale.
http://www.bargainsonsale.
http://www.bargainsonsale.
to this page
http://www.bargainsonsale.
from either the web.config or global.aspx page.
Also is there a risk I could be penalized by google for redirecting hundreds of pages to a single page using a 301 redirect.
I would really appreciate an answer.
Thanks
Ashley
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
for multiple redirects.. IF really very big amount of redirects(hundreds or thousands) what i advice u is to create a temp table that ll match productID or old url and new url of the pages..
then on the global.asax file on the begin_request event redirect as u do in ur sample code.. settings http header values.. but be4 that clear all content.. clear all header then set the new header values..
It will only be hundreds of redirects (about 200 to be precise). I dont want to bother with a database temp table. I would not know how to use it with the global.aspx.
Could you just provide the code I would insert into global.aspx for 2 or 3 page redirects.
For example lets say I want to redirect these three pages
http://www.mysite.com/cate
http://www.mysite.com/cate
http://www.mysite.com/cate
to this page:
http://www.mysite.com/new_
How would i do this from the global.aspx page or web.config assuming that those 3 pages no longer exist.
I can then use your code and replicate it for the 200 pages I want to redirect. This would be better then clogging up my site with 200 pages and then inserting redirect code for each one.
for 200 sites or more u need a list of the pages..
u can store pairs in sql, xml,csv or what ever u want
it depends on u
but without an list and an algorithm u ave to rite redirect to all pages that needs to be redirected
in global.asax file..
add an begin resuest handler..
load ur data in an hastable...when application start
then in beginrequest handler
if u get an request within the hastable
then
clear response data
and set header values.. response.status to 301
location to value from hastable
Do you mean a hash table?
I dont want to create any tables. I just require code. I dont mind copy and pasting the code for each URL redirect so long as its in the global.aspx or web.config. I just dont want 200 pages for each redirect.
A possible solution to my original question may look like the following placed in the global.aspx or web.config file::
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Response.Status = "301 Moved Permanently"
Request.AddHeader("Locatio
Response.AddHeader("Locati
Response.Status = "301 Moved Permanently"
Request.AddHeader("Locatio
Response.AddHeader("Locati
Response.Status = "301 Moved Permanently"
Request.AddHeader("Locatio
Response.AddHeader("Locati
End Sub
I would then just copy and paste and alter the URLs for the remaining pages i want to redirect. So long as the application does not run any slower I prefer this method.
Business Accounts
Answer for Membership
by: rkworldsPosted on 2009-11-06 at 21:03:14ID: 25765059
http://www.unrealstudio.co m/301-redi rect.shtml
seo-script s-10/301-r edirect-wi th- multipl e-urls-is- it-friendl y-202380.h tml
com/forum4 7/1570.htm
http://forums.seochat.com/
http://www.webmasterworld.