Forum Moderators: phranque

Message Too Old, No Replies

How to update automatically from one spot the links in all my websites

it's long to write the links manually

         

centreurope

8:10 am on Sep 15, 2007 (gmt 0)

10+ Year Member



Hi,
I've got several websites on which I put links to my other websites. All are located on different ip addresses.
What I would like is not to have to write manually the links in each website but rather find a way to put them in a single file, which will allow the links on the websites to be updated automatically.
how to do that?
thanks a lot
david

jtara

7:30 pm on Sep 15, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Are they all on the same server? If not, why not? (A good reason would be that you have zillions of users, and need more than one server.)

I'm guessing that you have several single-site hosting plans, perhaps with different hosting companies.

Consolidate your sites on one host that allows you to host multiple domains on the same account, and point them (at least the links page) at the same content.

Otherwise, you could certainly write an "updater" shell script that would FTP or SFTP the file(s) from a "master" site to the others. Your could either run then manually whenever you do an update, or run it as a cron job. That's assuming your host allows you to run scripts and cron jobs. Otherwise, you can do this with some extra overhead from a third location. (e.g. your PC - you'd have to download the files from the master and upload them to the others.)

centreurope

8:30 pm on Sep 15, 2007 (gmt 0)

10+ Year Member



thanks for your answer

Are they all on the same server? If not, why not?
----- all different servers, for seo purposes

I'm guessing that you have several single-site hosting plans, perhaps with different hosting companies.
--------- yes, and also 2 dedicated servers

Consolidate your sites on one host that allows you to host multiple domains on the same account,
----------Oh no! the links will have a negative impact.

and point them (at least the links page) at the same content.
---- i don't understand

Otherwise, you could certainly write an "updater" shell script that would FTP or SFTP the file(s) from a "master" site to the others. Your could either run then manually whenever you do an update, or run it as a cron job. That's assuming your host allows you to run scripts and cron jobs. Otherwise, you can do this with some extra overhead from a third location. (e.g. your PC - you'd have to download the files from the master and upload them to the others.)
------------- My programming skills are close to null. I hoped that I could find an existing tool, simple to use

Marcia

8:49 pm on Sep 15, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Use a PHP include for each site so the links won't have to be changed manually on each page. Includes just need the one file changed. You dont have to change the file extensions to use includes; if you're on Apache hosting you just need an entry in .htaccess telling the server to process PHP on regular htm or html pages.

jtara

9:10 pm on Sep 15, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I hoped that I could find an existing tool, simple to use

It's called "ftp", or "sftp". Couldn't be much simpler.

Just write FTP or SFTP commands, one per line, in a text file called, say, update.sh.

e.g.

sftp links.html user@example1.com /somewhere/links.html
sftp links.html user@example2.com /somewhere/links.html

etc.

Make it executable (chmod u+x update.sh). Run the script, and it will update all of your sites.

You really ought to learn the basics of basic Linux command-line utilities and shell scripting. (I am assuming that your sites are hosted on Linux systems.) Bet your are a Windows user primarily (like most of us). You're used to using a different application designed specifically to do each thing, on an OS (Windows) that has poor scripting capability. Linux is a different world - there are a vast array of simple tools that can be "plugged together" to perform most any repetitive administrative task.

I've over-simplified a bit, so you will have to read-up on ftp/sftp to know where to stick the password. Best is to use sftp and public-key authentication (which requires a bit of setup), and then you won't need to use a password.

That said, your hosting plans may simply not be up to the task. If you can't at least log-in to a shell prompt, it's going to be more difficult, and you'll have to automate it from an outside computer (e.g. your desktop.)

[edited by: jtara at 9:27 pm (utc) on Sep. 15, 2007]

jtara

9:15 pm on Sep 15, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Consolidate your sites on one host that allows you to host multiple domains on the same account,
----------Oh no! the links will have a negative impact.

You can host sites with different IP addresses on a single server. It is true, however, that most hosts are going to allocate IPs in sequence from a single subnet, though. Some hosts might be able to provide you with IPs from different subnets, though, if you ask nice. :)

and point them (at least the links page) at the same content.
---- i don't understand

You have, say, 10 websites running on the same web server. Any duplicate content doesn't have to be literally duplicated in 10 different directories. on the hard disk. All the sites can access the same file. You'd have to learn a bit about Apache configuration, though.

Use a PHP include for each site so the links won't have to be changed manually on each page. Includes just need the one file changed. You dont have to change the file extensions to use includes;

Either a PHP or text include would be one way to do this on a multiple-site server. This would allow you to "brand" the page for each site, (each with it's own unique header, footer, style sheet, etc.) but include a common file with the links.

This won't work with your sites hosted separately. The only way to do this with the sites hosted separately would be with a reverse-proxy, and either an iFrame or having a CMS fetch the links page through the reverse proxy. Probably overkill, and certainly will slow things down.

Your best bet is probably to slosh the file around to the various servers using ftp or sftp.

centreurope

9:54 pm on Sep 15, 2007 (gmt 0)

10+ Year Member



many thanks for those intelligent answers!
I will do my best to understand
david