Print Page | Close Window

Replacing domain name in threads?

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=24790
Printed Date: 29 March 2026 at 3:12am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Replacing domain name in threads?
Posted By: PrivateEye
Subject: Replacing domain name in threads?
Date Posted: 09 November 2007 at 5:12pm

I am running WWF on domain name http://www.domain1.com - www.domain1.com and by chance I need to transfer all my files and database to domain http://www.domain2.com - www.domain2.com Now all the links of file uploaded and images will refer to http://www.domain1.com - www.domain1.com and user will get error when they click on links from http://www.domain2.com - www.domain2.com can anyone please help me how to replace http://www.domain1.com - www.domain1.com to http://www.domain2.com - www.domain2.com in 'message' field of tblThread table with SQL query?



-------------
The Judgement Day



Replies:
Posted By: MadDog
Date Posted: 09 November 2007 at 5:35pm
I dont know how great this will work, so make sure you do a backup before you run this!

Update tblThread SET Message = Replace(Message, 'www.domain1.com', 'www.domain2.com')


Good luck.


-------------
http://www.iportalx.net" rel="nofollow">


Posted By: PrivateEye
Date Posted: 10 November 2007 at 11:16am

thank you for help, but domain name is not the ONLY entry in the 'Message' column. It also contain other message text as wel. Will replace function search in the whole string for 'www.domain1.com' and replace it with 'www.domain2.com' efficiently?



-------------
The Judgement Day


Posted By: Scotty32
Date Posted: 10 November 2007 at 11:39am
Im not sure if the above code would work as ive never tried it on a database before.

But Replace is a standard ASP function and simply replaces "www.domain1.com" with "www.domain2.com" for example:

Quote have you seen this thread <a href="http://www.domain1.com/forum/forum_posts.asp?TID=12345">here</a>, its funny


would become

Quote have you seen this thread <a href="http://www.domain2.com/forum/forum_posts.asp?TID=12345">here</a>, its funny


If your worried about the function you can always test it in an ASP page. just copy the content below into a new file, call it "test.asp" and upload it.

<%
strMessage = "enter what ever you want to test here"
strOldText = "www.domain1.com"
strNewText = "www.domain2.com"

strMessageOut = ReplacestrMessage,strOldText,strNewText)

Response.Write(strMessageOut)
%>



-------------
S2H.co.uk - http://www.s2h.co.uk/wwf/" rel="nofollow - WebWiz Mods and Skins

For support on my mods + skins, please use http://www.s2h.co.uk/forum/" rel="nofollow - my forum .


Posted By: PrivateEye
Date Posted: 10 November 2007 at 12:09pm
I am in great trouble because of this problem. I have to buy WWF and use it with my old DB on new website thats why I am worried. You think scotty32 that your code will work reliably?

-------------
The Judgement Day


Posted By: Scotty32
Date Posted: 10 November 2007 at 12:49pm
as i said, ive never tried it on a database so i dont know wot the outcome would be.

As maddog said, back up your database before you try this just incase it doesnt work.

Also which database are you using?


-------------
S2H.co.uk - http://www.s2h.co.uk/wwf/" rel="nofollow - WebWiz Mods and Skins

For support on my mods + skins, please use http://www.s2h.co.uk/forum/" rel="nofollow - my forum .


Posted By: PrivateEye
Date Posted: 10 November 2007 at 1:14pm
using wwf v8 SQL Server database.

-------------
The Judgement Day


Posted By: MortiOli
Date Posted: 10 November 2007 at 5:33pm
I'm sure images and files which have been uploaded by users etc through the WWF upload option, doesn't use the full URL to the images - ie, www.domain.com/uploads/images/1.gif it just uses /uploads/images/1.gif

What I'd do is take a backup of your database, get the forum setup on your new domain, using the backup of your database, and see what happens - view the properties of the uploaded images, and see where they're being loaded from.  Once you're happy, close domain1, move the database over, then open domain2.


Posted By: PrivateEye
Date Posted: 10 November 2007 at 8:25pm
I have doubt in it. I checked one post in the 'message' column that used wwf smiley and the full URL is saved in the database. Cry

-------------
The Judgement Day


Posted By: dpyers
Date Posted: 14 November 2007 at 11:02pm
Easiest way would be to just make domain1 a dns alias of domain2. That way any traffic/external links that reference domain1 would also go to domain2.

-------------

Lead me not into temptation... I know the short cut, follow me.


Posted By: PrivateEye
Date Posted: 15 November 2007 at 4:28pm
thank you for your reply, I am still looking for a solution before I launch my website. Will you pls elaborate that how can make domain1 a dns alias of domain2 in the database. Many thanks in advance.

-------------
The Judgement Day



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net