Moving to new server, images links are still pointing to the old server?

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Locked
icammy

Moving to new server, images links are still pointing to the old server?

Post by icammy »

Hi all,
I have a develop server and a publish server.
Let the IP= 192.168.8.12 and 192.168.8.13 for these two servers.
Once I have tested all my code in the develop server, I would like to move them to the publish server.
I followed the small HOWTO in http://wiki.cmsmadesimple.org/index.php ... New_Server.
It work well for the contents and internal links.
But I would like to ask, what about the images that I have added in the develop server?
They are still pointing to the IP:192.168.8.12 instead of 192.168.8.13.
I have enabled the Pretty URL.
Is that I can't use the relative path for the images and the links as I am using the Pretty URL?
Thanks in advance!! =]
TimothyFoo
Forum Members
Forum Members
Posts: 44
Joined: Wed Oct 12, 2005 8:50 pm

Re: Moving to new server, images links are still pointing to the old server?

Post by TimothyFoo »

You need to update your config.php file. Specifically the following entries:

Code: Select all

#Default path and URL for uploaded images in the image manager
$config['image_uploads_path'] = '/home/dir/public_html/uploads/images';
$config['image_uploads_url'] = 'http://yoursite.com/uploads/images'; 
You will also need to change any other entry that points to your staging server, to point to your live server.
icammy

Re: Moving to new server, images links are still pointing to the old server?

Post by icammy »

Thanks Timothy!! ;)

I have two more question to ask.
1.Is that I can only change the entrys that points to my staging server to point to live server one by one? Is there any faster way?

2.And as I am using Pretty URL and I would also like to use the relative path for the links and images,
so that I need not to change all the links when I publish my web.

But when I use Pretty URLs
the links for the images will be http://192.168.8.12/cms/about-us/upload ... s/logo.gif
insteads of http://192.168.8.12/cms/uploads/images/logo.gif
while /about-us/ is added by the system as I am using Pretty URLs.
It makes the pic can't be loaded.
I have already set the metadata showbase = ture

Could anybody give me some hints to solve this problem??
Thanks a lot!!
Last edited by icammy on Tue Nov 28, 2006 2:11 am, edited 1 time in total.
TimothyFoo
Forum Members
Forum Members
Posts: 44
Joined: Wed Oct 12, 2005 8:50 pm

Re: Moving to new server, images links are still pointing to the old server?

Post by TimothyFoo »

You're welcome.

1. Well, you could reinstall the CMS on the new server, but select the option for no tables to be created in the database (so your data doesn't get overwritten) That would create a new config.php for you, but I don't think it will really be any quicker. I use a source code editor called SciTe, from here: http://scintilla.org/ it has a good search and replace function. That might make it quicker.

2. Use relative links for your images, rather than actual paths... eg. instead of using

Code: Select all

<img src="192.168.8.12/cms/about-us/uploads/images/logo.gif" />
just use

Code: Select all

<img src="uploads/images/logo.gif" />
icammy

Re: Moving to new server, images links are still pointing to the old server?

Post by icammy »

Thank you so much, Timothy!!! :D

Thanks for your recommendation about the source code editor, SciTe! I will try it later!! =]

For the relative links issue, I have tried to change the links to
, but the images are unloaded.
I have check with the links of these images, and it is
http://192.168.8.12/cms/about-us/upload ... s/logo.gif
what I wish to be is actually http://192.168.8.12/cms/uploads/images/logo.gif
/about-us/ is added by Pretty URLs.
Is that I can only choose to use either Pretty URLs or relative paths?
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

Re: Moving to new server, images links are still pointing to the old server?

Post by Dr.CSS »

Do you have {metadata} tag in the of the template?...
TimothyFoo
Forum Members
Forum Members
Posts: 44
Joined: Wed Oct 12, 2005 8:50 pm

Re: Moving to new server, images links are still pointing to the old server?

Post by TimothyFoo »

No problem icammy, you're welcome.

Mark knows a lot more about CMSMS than me. He's probably on the right track with the metadata smarty tag.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

Re: Moving to new server, images links are still pointing to the old server?

Post by Dr.CSS »

The {metadata} Tag will usually add in the head so relative links will work...

If you don't get the base link in your then paste the call in the Global Metadata: in Site Admin » Global Settings...

NOTE it must be in html format as above
icammy

Re: Moving to new server, images links are still pointing to the old server?

Post by icammy »

Thank you so much!!!
Thanks Timothy and Mark!!!!!! ;)
It's work!!!!!!! Both of you are hero!!!! :P
Locked

Return to “CMSMS Core”