Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Replacing domain name in threads?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Replacing domain name in threads?

 Post Reply Post Reply Page  12>
Author
PrivateEye View Drop Down
Groupie
Groupie
Avatar

Joined: 21 March 2003
Location: United Kingdom
Status: Offline
Points: 168
Post Options Post Options   Thanks (0) Thanks(0)   Quote PrivateEye Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
MadDog View Drop Down
Mod Builder Group
Mod Builder Group
Avatar

Joined: 01 January 2002
Status: Offline
Points: 3008
Post Options Post Options   Thanks (0) Thanks(0)   Quote MadDog Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
PrivateEye View Drop Down
Groupie
Groupie
Avatar

Joined: 21 March 2003
Location: United Kingdom
Status: Offline
Points: 168
Post Options Post Options   Thanks (0) Thanks(0)   Quote PrivateEye Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Scotty32 View Drop Down
Moderator Group
Moderator Group


Joined: 30 November 2002
Location: Manchester, UK
Status: Offline
Points: 1682
Post Options Post Options   Thanks (0) Thanks(0)   Quote Scotty32 Quote  Post ReplyReply Direct Link To This Post 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)
%>



Edited by Scotty32 - 10 November 2007 at 11:40am
S2H.co.uk - WebWiz Mods and Skins

For support on my mods + skins, please use my forum.
Back to Top
PrivateEye View Drop Down
Groupie
Groupie
Avatar

Joined: 21 March 2003
Location: United Kingdom
Status: Offline
Points: 168
Post Options Post Options   Thanks (0) Thanks(0)   Quote PrivateEye Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Scotty32 View Drop Down
Moderator Group
Moderator Group


Joined: 30 November 2002
Location: Manchester, UK
Status: Offline
Points: 1682
Post Options Post Options   Thanks (0) Thanks(0)   Quote Scotty32 Quote  Post ReplyReply Direct Link To This Post 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 - WebWiz Mods and Skins

For support on my mods + skins, please use my forum.
Back to Top
PrivateEye View Drop Down
Groupie
Groupie
Avatar

Joined: 21 March 2003
Location: United Kingdom
Status: Offline
Points: 168
Post Options Post Options   Thanks (0) Thanks(0)   Quote PrivateEye Quote  Post ReplyReply Direct Link To This Post Posted: 10 November 2007 at 1:14pm
using wwf v8 SQL Server database.
The Judgement Day
Back to Top
MortiOli View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 May 2002
Location: United Kingdom
Status: Offline
Points: 514
Post Options Post Options   Thanks (0) Thanks(0)   Quote MortiOli Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
 Post Reply Post Reply Page  12>

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.