homepage Welcome to WebmasterWorld Guest from 54.205.119.163
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld

Home / Forums Index / Microsoft / Microsoft IIS Web Server and ASP.NET
Forum Library, Charter, Moderators: ocean10000

Microsoft IIS Web Server and ASP.NET Forum

    
301 redirect on dynamic pages
Moved to static pages - How do I stop duplicate content in search engines
Elmo




msg:942381
 11:54 am on Oct 12, 2004 (gmt 0)

Situation

New site
Windows hosted
20,000+ pages
structure as follows

Homepage - default.asp
120 links to level 2 pages

Level 2 pages - www.domain.com/somepage.asp?pageID=123
each level 2 page has 130 links pointing to level 3 pages

My problem is this:

The site has been up only 3 weeks and Google have picked up 4000 pages including all level 2 pages.

We hadn't expected pages to be picked up quite so fast and therefor have a slight problem. We have now changed level 2 pages to - www.domain.com/somepage123
i.e. its own subdirectory with a default.asp page.

Anyone know how we can use a 301 redirect from our somepage.asp?pageID=? page that has 120 IDs to their respective suddirectory pages

 

Birdman




msg:942382
 12:11 pm on Oct 12, 2004 (gmt 0)

Hello Elmo,

I'm not an ASP programmer but I believe this should do the job for you. Simply use the paramater from the URL to build your new location. Also, be sure to check the header after implementing to make sure it is working properly.

Response.Status "301 Moved Permanently"
Response.AddHeader "Location", "YOUR_NEW_URL"

Regards,
Birdman

Elmo




msg:942383
 12:54 pm on Oct 12, 2004 (gmt 0)

I'm not an ASP programmer

Nor me

Thanks Birdman

I understand how to do it one page to another, the problem is how do I do it for one page that has 120 IDs which all need to go to different destinations.

dotme




msg:942384
 2:10 pm on Oct 12, 2004 (gmt 0)

I think this should do it. Someone else here can maybe check my thinking?

pageid = cstr(request("pageID"))
newurl = "www.domain.com/somepage" & pageid
response.status "301 Moved Permanently"
response.AddHeader "Location", "" & newurl & ""

macrost




msg:942385
 2:40 pm on Oct 12, 2004 (gmt 0)

dotme,
I believe that will work, depending on if they can use a 404 page for the old links. <thinking> hmmmm, that could work, I just wonder if the second level pages are just one page that pulls content depending on the page id, if so, then in that page they can just add that bit of code you have and that should do the trick</thinking>

Mac

Elmo




msg:942386
 4:11 pm on Oct 12, 2004 (gmt 0)

Thanks, I will get back once I have spoken to the programmer.

Elmo




msg:942387
 12:50 pm on Oct 15, 2004 (gmt 0)

I have added the code as suggested and it works.

Thanks for the help Dotme and Birdman.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Microsoft / Microsoft IIS Web Server and ASP.NET
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved