Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-11-07 10:44:11

kevinmcdougall
Member
Registered: 2007-02-08
Posts: 55

Internal Links Not Updating

Hi,

I seem to be having a problem with internal links (ie textile links within articles, to other articles on the same site) when I move the site from one domain to another. The only way I can be certain that the links don’t refer to the previous domain (eg development domain) is to go through all of the articles and re-save them. Tedious to say the least.

Anyone else experienced this? Anyone got a quicker fix than re-saving 500+ articles? Please?

Offline

#2 2007-11-07 17:49:33

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Internal Links Not Updating

What do the links look like?

Offline

#3 2007-11-07 18:04:24

kevinmcdougall
Member
Registered: 2007-02-08
Posts: 55

Re: Internal Links Not Updating

Just like normal links Els, except the domain name is wrong.

If I’ve added link into the body of an article on the testing domain (www.devdomain.com), say something like "Contact Us":contact/contact-us for example, when the site is moved to the live domain (www.livedomain.com) the links do not update until I re-save them. So the link will appear as <a href="http://www.devdomain.com/contact/contact-us" >Contact Us</a> instead of <a href="http://www.livedomain.com/contact/contact-us" >Contact Us</a> despite having changed the prefs. Admittedly I did change the prefs directly in the db while I was moving it, rather than from the TXP admin tab.

The worst of it is that I hadn’t noticed until after Google had been through the live site, meaning that the links which still pointed to the dev site got indexed. Doh!

Offline

#4 2007-11-07 18:35:20

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Internal Links Not Updating

Ok, so it’s not your fault ;)
The reason why this is happening is that the article body is saved in two different fields in the table, ‘Body’ and ‘Body_html’. The ‘Body_html’ field contains this <a href="http://www.devdomain.com/contact/contact-us" >Contact Us</a>. An alternative for re-saving all articles is to replace all ‘devdomain’ with ‘livedomain’ using a MySQL query. Something like this should do it, but please wait for a confirmation from someone who is better with MySQL than I am.

UPDATE textpattern SET Body_html = REPLACE(Body_html, 'devdomain', 'livedomain');

Edit: for future moves: if I am not mistaken this won’t happen when you use <txp:permlink id="123">Text</txp:permlink> instead.

Last edited by els (2007-11-07 18:49:06)

Offline

#5 2007-11-07 21:07:18

kevinmcdougall
Member
Registered: 2007-02-08
Posts: 55

Re: Internal Links Not Updating

Thanks Els,

Not likely to use (and neither would end-user!) the tags as opposed to textile, but having the query will make things much easier. Really appreciate you taking a look at it. Thanks again!

Kevin

Offline

#6 2007-11-07 23:29:45

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: Internal Links Not Updating

The query is right, you’ll just want to do it to both fields:

UPDATE textpattern SET Body = REPLACE(Body, 'devdomain.com', 'livedomain.com'), Body_html = REPLACE(Body_html, 'devdomain.com', 'livedomain.com');

Offline

Board footer

Powered by FluxBB