Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Help Groups for Snitz Forums 2000 Users
 Help: General / Classic ASP versions(v3.4.XX)
 redirecting to new site but keep valid link
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Helterskelter
Junior Member

United Kingdom
331 Posts

Posted - 09 January 2009 :  16:02:36  Show Profile  Visit Helterskelter's Homepage  Send Helterskelter an ICQ Message
Just a quick question.

I've moved my site and want to redirect all link to the new site.

I'm trying to use the following code



quote:
Dim Topic
Topic = Request.Querystring("TOPIC_ID")
Response.redirect("mynewsite.com/topic.asp?TOPIC_ID=""" & Topic & """")




But it's just going to the default.asp page!
The idea is to google links etc etc will link to to correct page on the new site.

[edit]Sorry i pasted the code and it added it as a single line<


Edited by - Helterskelter on 10 January 2009 04:58:21

Carefree
Advanced Member

Philippines
4217 Posts

Posted - 09 January 2009 :  16:21:48  Show Profile
Response.redirect "mynewsite.com/topic.asp?TOPIC_ID="& Topic

Although the above would work with your approach, here's your entire routine in a single line, nothing else needed:
Response.Redirect "mynewsite.com/topic.asp?TOPIC_ID="& Request.Querystring("TOPIC_ID")
<

Edited by - Carefree on 09 January 2009 19:47:19
Go to Top of Page

gary b
Junior Member

USA
267 Posts

Posted - 09 January 2009 :  16:40:24  Show Profile  Visit gary b's Homepage
quote:
Originally posted by Helterskelter

Dim Topic Topic = Request.Querystring("TOPIC_ID") Response.redirect("mynewsite.com/topic.asp?TOPIC_ID=""" & Topic & """")


Most redirects I have seen redirect to a page... If redirecting to a site, don't you need the http prefix? I would see if your redirect works using simple example.
Response.Redirect "http://www.w3schools.com"

Then build from there. (Use Response.Write to confirm 'topic' <> Null

From W3School website:
http://www.w3schools.com/ASP/met_redirect.asp

Syntax

Response.Redirect URL

Parameter Description
URL Required. The URL that the user (browser) is redirected to
Examples

<%
Response.Redirect "http://www.w3schools.com"
%><
Go to Top of Page

Carefree
Advanced Member

Philippines
4217 Posts

Posted - 09 January 2009 :  17:07:20  Show Profile
Gary, the "mynewsite.com" isn't the actual URL. His redirect is working (partially) since it is reaching his default.asp page. His problem was in the syntax of the topic_id.<
Go to Top of Page

bobby131313
Senior Member

USA
1163 Posts

Posted - 09 January 2009 :  17:17:44  Show Profile  Visit bobby131313's Homepage
You're gonna want to try to figure a way send a 301 Permanently Moved header also.<

Switch the order of your title tags
Go to Top of Page

SiSL
Average Member

Turkey
671 Posts

Posted - 09 January 2009 :  18:43:19  Show Profile  Visit SiSL's Homepage
quote:
Originally posted by bobby131313

You're gonna want to try to figure a way send a 301 Permanently Moved header also.



You can't 301 redirect if you already printed out something like Response.Write of any kind etc., which is sad...

Beside that Response.AddHeader would be just fine...
<

CHIP Online Forum

My Mods
Select All Code | Fix a vulnerability for your private messages | Avatar Categories W/ Avatar Gallery Mod | Complaint Manager
Admin Level Revisited | Merge Forums | No More Nested Quotes Mod
Go to Top of Page

Classicmotorcycling
Development Team Leader

Australia
2085 Posts

Posted - 09 January 2009 :  18:45:55  Show Profile
I changed my site around and found that people still had topics and forums as bookmarks so I created the following (real close to your code) redirection pages :

default.asp:
<%
Dim cat

cat = Request.Querystring("CAT_ID")

if cat <> "" then
Response.Redirect("/forums/default.asp?CAT_ID=" & cat & "")
else
Response.Redirect("/forums/default.asp")
end if
%>


forum.asp:
<%
Dim forum

forum = Request.Querystring("FORUM_ID")

Response.Redirect("/forums/forum.asp?FORUM_ID=" & forum & "")
%>


topic.asp
<%
Dim Topic

Topic = Request.Querystring("TOPIC_ID")

Response.Redirect("/forums/topic.asp?TOPIC_ID=" & Topic & "")
%>


Just change the /forums part to where you want them to be reditected to and it should work as it has worked for me.

I hope that this helps. <

Cheers,

David Greening
Go to Top of Page

bobby131313
Senior Member

USA
1163 Posts

Posted - 09 January 2009 :  18:56:07  Show Profile  Visit bobby131313's Homepage
quote:
You can't 301 redirect if you already printed out something like Response.Write of any kind etc., which is sad...

Beside that Response.AddHeader would be just fine...


I don't know if this will help but I moved an entire directory on my site to another one. The file names stayed the same. I used the following code on all the old pages after I moved them and the header worked perfectly....


<%@ Language=VBScript %>
<%
dim strFileName 
dim scriptname 

scriptname = split(request.servervariables("SCRIPT_NAME"),"/")
strFileName = scriptname(ubound(scriptname))

Response.Status="301 Moved Permanently"
Response.AddHeader "Location", "http://www.coincommunity.com/coin_facts/dollars/" & strFileName
%>


Here's an example with this code....

http://www.coincommunity.com/coin_facts/dollars_notes/1794_flowing_hair_dollar.asp<

Switch the order of your title tags

Edited by - bobby131313 on 09 January 2009 18:58:32
Go to Top of Page

SiSL
Average Member

Turkey
671 Posts

Posted - 09 January 2009 :  19:17:15  Show Profile  Visit SiSL's Homepage
Actually, just add Request.QueryString to that and it will be just fine :)

<%

Rqs = Request.QueryString
if Rqs <> "" Then
strFileName = strFileName & "?" & Rqs
End If

%>

Right before Response.Status

<

CHIP Online Forum

My Mods
Select All Code | Fix a vulnerability for your private messages | Avatar Categories W/ Avatar Gallery Mod | Complaint Manager
Admin Level Revisited | Merge Forums | No More Nested Quotes Mod
Go to Top of Page

Helterskelter
Junior Member

United Kingdom
331 Posts

Posted - 10 January 2009 :  05:02:29  Show Profile  Visit Helterskelter's Homepage  Send Helterskelter an ICQ Message
quote:
Originally posted by Classicmotorcycling

I changed my site around and found that people still had topics and forums as bookmarks so I created the following (real close to your code) redirection pages :

default.asp:
<%
Dim cat

cat = Request.Querystring("CAT_ID")

if cat <> "" then
Response.Redirect("/forums/default.asp?CAT_ID=" & cat & "")
else
Response.Redirect("/forums/default.asp")
end if
%>


forum.asp:
<%
Dim forum

forum = Request.Querystring("FORUM_ID")

Response.Redirect("/forums/forum.asp?FORUM_ID=" & forum & "")
%>


topic.asp
<%
Dim Topic

Topic = Request.Querystring("TOPIC_ID")

Response.Redirect("/forums/topic.asp?TOPIC_ID=" & Topic & "")
%>


Just change the /forums part to where you want them to be reditected to and it should work as it has worked for me.

I hope that this helps.



Thanks Classic been a long time since I'm needed any help and that's exactly what I'm looking for. Will try it now.

Looking it's a stupid error on my part with to many "......<

Go to Top of Page

Helterskelter
Junior Member

United Kingdom
331 Posts

Posted - 10 January 2009 :  05:09:27  Show Profile  Visit Helterskelter's Homepage  Send Helterskelter an ICQ Message
Thats got it......... all my fault should of noticed i was stupid!!!!!!!!!<

Go to Top of Page

Classicmotorcycling
Development Team Leader

Australia
2085 Posts

Posted - 10 January 2009 :  09:01:10  Show Profile
No problems, anytime. Glad I was able to help. <

Cheers,

David Greening
Go to Top of Page

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 12 January 2009 :  06:22:11  Show Profile
Do you have direct access to IIS on the server used to host the old site?

<

Search is your friend
“I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
Go to Top of Page

Helterskelter
Junior Member

United Kingdom
331 Posts

Posted - 13 January 2009 :  12:33:22  Show Profile  Visit Helterskelter's Homepage  Send Helterskelter an ICQ Message
no sadily.<

Go to Top of Page

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 13 January 2009 :  12:47:51  Show Profile
Pity; you could have achieved what you wanted quite easily through IIS without the need for any ASP trickery.

<

Search is your friend
“I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
Go to Top of Page

Helterskelter
Junior Member

United Kingdom
331 Posts

Posted - 13 January 2009 :  23:22:53  Show Profile  Visit Helterskelter's Homepage  Send Helterskelter an ICQ Message
Oh i see what ur getting at, but no sadly i pay for hosting.
Still i got the redirects working, now just in a month when i move hosting I'll lose all the links as it's my main site will be in php (only as it's cheeper).
<

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.47 seconds. Powered By: Snitz Forums 2000 Version 3.4.07