Author |
Topic  |
|
Helterskelter
Junior Member
 
United Kingdom
331 Posts |
Posted - 09 January 2009 : 16:02:36
|
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
|
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 |
 |
|
gary b
Junior Member
 
USA
267 Posts |
Posted - 09 January 2009 : 16:40:24
|
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" %>< |
 |
|
Carefree
Advanced Member
    
Philippines
4217 Posts |
Posted - 09 January 2009 : 17:07:20
|
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.< |
 |
|
bobby131313
Senior Member
   
USA
1163 Posts |
|
SiSL
Average Member
  
Turkey
671 Posts |
|
Classicmotorcycling
Development Team Leader
    
Australia
2085 Posts |
Posted - 09 January 2009 : 18:45:55
|
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:
forum.asp:
topic.asp
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 |
 |
|
bobby131313
Senior Member
   
USA
1163 Posts |
Posted - 09 January 2009 : 18:56:07
|
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 |
 |
|
SiSL
Average Member
  
Turkey
671 Posts |
|
Helterskelter
Junior Member
 
United Kingdom
331 Posts |
Posted - 10 January 2009 : 05:02:29
|
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:
forum.asp:
topic.asp
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 "......< |
 |
 |
|
Helterskelter
Junior Member
 
United Kingdom
331 Posts |
Posted - 10 January 2009 : 05:09:27
|
Thats got it......... all my fault should of noticed i was stupid!!!!!!!!!< |
 |
 |
|
Classicmotorcycling
Development Team Leader
    
Australia
2085 Posts |
Posted - 10 January 2009 : 09:01:10
|
No problems, anytime. Glad I was able to help. < |
Cheers, David Greening |
 |
|
Shaggy
Support Moderator
    
Ireland
6780 Posts |
Posted - 12 January 2009 : 06:22:11
|
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.” |
 |
|
Helterskelter
Junior Member
 
United Kingdom
331 Posts |
Posted - 13 January 2009 : 12:33:22
|
no sadily.< |
 |
 |
|
Shaggy
Support Moderator
    
Ireland
6780 Posts |
Posted - 13 January 2009 : 12:47:51
|
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.” |
 |
|
Helterskelter
Junior Member
 
United Kingdom
331 Posts |
Posted - 13 January 2009 : 23:22:53
|
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). < |
 |
 |
|
|
Topic  |
|