| Author |
Topic Search Topic Options
|
PrivateEye
Groupie
Joined: 21 March 2003
Location: United Kingdom
Status: Offline
Points: 168
|
Post Options
Thanks(0)
Quote Reply
Topic: Replacing domain name in threads? Posted: 09 November 2007 at 5:12pm |
I am running WWF on domain name www.domain1.com and by chance I need to transfer all my files and database to domain www.domain2.com Now all the links of file uploaded and images will refer to www.domain1.com and user will get error when they click on links from www.domain2.com can anyone please help me how to replace www.domain1.com to www.domain2.com in 'message' field of tblThread table with SQL query?
Edited by PrivateEye - 09 November 2007 at 5:26pm
|
|
The Judgement Day
|
 |
MadDog
Mod Builder Group
Joined: 01 January 2002
Status: Offline
Points: 3008
|
Post Options
Thanks(0)
Quote Reply
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.
|
|
|
 |
PrivateEye
Groupie
Joined: 21 March 2003
Location: United Kingdom
Status: Offline
Points: 168
|
Post Options
Thanks(0)
Quote Reply
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
|
 |
Scotty32
Moderator Group
Joined: 30 November 2002
Location: Manchester, UK
Status: Offline
Points: 1682
|
Post Options
Thanks(0)
Quote Reply
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:
have you seen this thread <a href="http://www.domain1.com/forum/forum_posts.asp?TID=12345">here</a>, its funny |
would become
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) %> |
Edited by Scotty32 - 10 November 2007 at 11:40am
|
|
|
 |
PrivateEye
Groupie
Joined: 21 March 2003
Location: United Kingdom
Status: Offline
Points: 168
|
Post Options
Thanks(0)
Quote Reply
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
|
 |
Scotty32
Moderator Group
Joined: 30 November 2002
Location: Manchester, UK
Status: Offline
Points: 1682
|
Post Options
Thanks(0)
Quote Reply
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?
|
|
|
 |
PrivateEye
Groupie
Joined: 21 March 2003
Location: United Kingdom
Status: Offline
Points: 168
|
Post Options
Thanks(0)
Quote Reply
Posted: 10 November 2007 at 1:14pm |
|
using wwf v8 SQL Server database.
|
|
The Judgement Day
|
 |
MortiOli
Senior Member
Joined: 26 May 2002
Location: United Kingdom
Status: Offline
Points: 514
|
Post Options
Thanks(0)
Quote Reply
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.
|
 |