If Querystring = Value, Redirect?

  • Thread starter Thread starter Badass Scotsman
  • Start date Start date
Badass said:
Hello,

I have a dynamically generated site, with a URL format like so:

www.site.com/index.aspx?Content=Horses
www.site.com/index.aspx?Content=Parrots
And so on...

What i would like to do, on page somewhere, is this:

if QueryString Content = Horses
then
301 permanent redirect to
www.newsite.com/animals.aspx?Content=Horses

Trouble is, not really knowing how to code in .NET , im stumped :(
Assuming you will use VB.Net, in the Page_Onload event handler, do this:

If Request.QueryString("Content") = "Horses" then
Response.Redirect("www.newsite.com/animals.aspx?Content=Horses")
End if
 
Assuming you will use VB.Net, in the Page_Onload event handler, do this:
If Request.QueryString("Content") = "Horses" then
Response.Redirect("www.newsite.com/animals.aspx?Content=Horses")
End if


Hi,

Will the Response.Redirect have the same effect as a 301 permanently moved?
Will it return a 301 value to search engines? (Which is the sole reason for
this task...)

Regards,

Gary.
 
Badass said:
Hi,

Will the Response.Redirect have the same effect as a 301 permanently moved?
Will it return a 301 value to search engines? (Which is the sole reason for
this task...)

Regards,

Gary.
No it won't. Response.Redirect simply redirects the browser to the
specified page.
 
Back
Top