301 Redirect |
Post Reply | Page 12> |
Author | ||
avalight
Newbie Joined: 21-September-2007 Status: Offline Points: 3 |
Post Options
Thanks(0)
Posted: 22-December-2009 at 11:12pm |
|
What would be the best way to redirect this asp page:
http://www.avalanche-ranch.com/rusticlighting/pc/viewCategories.asp?idCategory=3 to this page http://www.avalanche-ranch.com/rusticlighting/pc/viewCategories.asp?idCategory=4 I want to use a 301 redirect. I have looked online for this. I don't see a solution. Perhaps the isapi rewrite? Looks pretty complicated. I have just stopped using that category... Thanks Curt Avalanche Ranch Light Company Edited by avalight - 22-December-2009 at 11:19pm |
||
Curt
|
||
Greg Dinger
Certified ProductCart Developers Joined: 23-September-2006 Location: United States Status: Offline Points: 238 |
Post Options
Thanks(0)
|
|
That's simple Curt. Just place a bit of code in your header.asp
Here is the code that allows you to grab the current page name.
Here is the code for an ASP 301 redirect.
You need to wrap the 301 redirect with an IF statement that tests for which page you are on. When you find that you are on the page you want to redirect from, pull the trigger and blast it.
|
||
worldofrugs
Senior Member Joined: 24-April-2008 Location: United States Status: Offline Points: 0 |
Post Options
Thanks(0)
|
|
Afraid it's not working for me :(
I tried adding this at the top of the page:
While the Re-Direct goes fine, the headr status is not returning 301, but 302! Any suggestions? Edited by worldofrugs - 02-June-2010 at 4:14pm |
||
worldofrugs
Senior Member Joined: 24-April-2008 Location: United States Status: Offline Points: 0 |
Post Options
Thanks(0)
|
|
Never mind... Figured it out... Should have used:
Response.AddHeader "Location", "/shop/pc/OtherPage.asp" instead of the Respnse.Redirect Time for more coffee!! |
||
Brett
Groupie Joined: 22-April-2008 Location: Phoenix, AZ Status: Offline Points: 89 |
Post Options
Thanks(0)
|
|
You might be able to find the category by simply doing:
<% if pIdCategory="number you want" then %> Since viewcategories.asp is already populating that variable |
||
worldofrugs
Senior Member Joined: 24-April-2008 Location: United States Status: Offline Points: 0 |
Post Options
Thanks(0)
|
|
Thanks for that tip Brett! Will try this out today and when it works (asuming it does), it will keep the coding a little cleaner
Thanks! |
||
Greg Dinger
Certified ProductCart Developers Joined: 23-September-2006 Location: United States Status: Offline Points: 238 |
Post Options
Thanks(0)
|
|
Paul, on another note, you should make it a general practice to sanitize your reference to querystring values. Whether the resulting value is sent to a query or not, use the "getuserinput" function. Were you to not do so when sending a querystring value to a query, you would create a security hold that could be deadly.
In your example above, the following statement would cause you massive grief "catnumber" was sent to a query and a hacker discovered it.
CatNumber= lcase(Request.ServerVariables("Query_String")) Edited by Greg Dinger - 03-June-2010 at 9:59am |
||
worldofrugs
Senior Member Joined: 24-April-2008 Location: United States Status: Offline Points: 0 |
Post Options
Thanks(0)
|
|
Thanks for that tip Greg...
However, as I am not a programming guru, I'm not sure how to implement this in my situation. I have quickly tried:
but this does not work. It simply goes to the "msg.asp?message=86" page (not a valid category), not resulting in the redirect I want and not returning the 301 header status. Did I miss something? |
||
worldofrugs
Senior Member Joined: 24-April-2008 Location: United States Status: Offline Points: 0 |
Post Options
Thanks(0)
|
|
Never mind Greg, I found the issue.
On the Wiki page you gave me, you have the line:
But it should actually be:
When I changed it this way, working great, so I assume that this is the best way to go? Thanks for pointing it out Greg, 'you tha man'! Edited by worldofrugs - 03-June-2010 at 10:31am |
||
Greg Dinger
Certified ProductCart Developers Joined: 23-September-2006 Location: United States Status: Offline Points: 238 |
Post Options
Thanks(0)
|
|
That's what I had in mind. You DO NOT want to wake up one day and receive reports that the store has been attacked. Concientious use of proper protection methods is absolutely critical.
|
||
Post Reply | Page 12> |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |