Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Advice on Moving Website

Advice on Moving Website
Thread Tools
Mac Enthusiast
Join Date: Jul 2003
Status: Offline
Reply With Quote
May 30, 2005, 03:48 PM
 
I have a partially developed website. When I wrote the HTML, I was too lazy to learn the how use relative referencing- so instead I used a universal address every time I made a link. I now realize how important this mistake was as I am trying to move the website to a different server. If I had simply used relative referencing, it would be a simple transfer!

Now I have to go through every page and edit every single link (tons of them) to make it a relative system. Does anyone have any advice on how to cut corners or create shortcuts to help me with this kind of task? Any way to use automator or something similar to make this job less painful?

Thanks for your sympathy and advice.
     
Mac Enthusiast
Join Date: Jul 2003
Status: Offline
Reply With Quote
May 30, 2005, 03:52 PM
 
I just read my post and realized that it might be a little confusing, as I am probably not using the correct verbage. I'd like to clarify- When I created a link to something, I typed something like: a href="http://www.absoluteaddress.com/" instead of: a href="//subfolder".

Does that make more sense? The example is an absolute reference and the second is relative.
     
Moderator
Join Date: Mar 2004
Location: Copenhagen
Status: Offline
Reply With Quote
May 30, 2005, 04:47 PM
 
Actually, I think your second post just confused things

But that's okay, 'cause it's quite clear what you mean in your first post...

I haven't had any monotonous, repetitive tasks to do since upgrading to Tiger, so I haven't really played around with Automator yet, and thus can't help you much there...

However, if you really do have a lot of links that need to be 'relativised', here's what I usually do:

Find all the folders you have linked to in the current page (ie. say you've got links to pages in four different folders on the domain http://www.it.com: one/, two/, three/, and four/), and the page you're currently in is it.com/five/page.htm.

Then just open the HTML file in a simple text editor (or SubEthaEdit, or whatever), and do a search and replace. Just tell it to search for 'http://www.it.com/one/' and replace all occurrences of that with './one/'; and then do the same for the other folders.

Just make sure you've got the correct relative paths all ready, otherwise you'll get your brain tied tightly in a Gordian knot of dots and slashes.
     
Grizzled Veteran
Join Date: Jun 2001
Location: Melbourne, Australia
Status: Offline
Reply With Quote
May 30, 2005, 07:27 PM
 
Originally Posted by Oisín
...replace all occurrences of that with './one/'; ...
That would create a relative link from the current folder, which wouldn't necessarily be correct.

I don't see the problem in doing a search and replace for http://www.it.com/ and replacing all occurrences of that with '/' - you still have absolute references (which are not always a bad thing) but it can sit on any virtual domain you choose. Get the free text editor from www.barebones.com if you'd like to simplify searching and replacing through nested folders
Computer thez nohhh...
     
Dedicated MacNNer
Join Date: Nov 2001
Location: Are Eye
Status: Offline
Reply With Quote
May 30, 2005, 07:51 PM
 
Ditto on find and replace through directories. I use BBEdit to do it quite often.

I wouldn't even bother making the paths relative, I'd just plug in the new domain

e.g.

find:
myolddomain.com
replace:
mynewdomain.com

done in one step.

Relative paths are more common because as you're finding out, they're easy; but there's something to be said absolute paths.
     
Mac Enthusiast
Join Date: Jul 2003
Status: Offline
Reply With Quote
May 30, 2005, 08:51 PM
 
Sound advice. Thanks. Good to know others have thought about this...
     
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
May 30, 2005, 09:21 PM
 
Even if you want to do absolute paths, I don't see any reason to hardcode the domain name rather than using "/" for the site's root directory.
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
Clinically Insane
Join Date: Oct 2000
Location: Los Angeles
Status: Offline
Reply With Quote
May 31, 2005, 07:14 AM
 
I think the OP already understands how to use relative paths, but if he doesn't here's a guide. What he's most interested in is batch processing of HTML; unfortunately I lack good suggestions on that front.

"The natural progress of things is for liberty to yield and government to gain ground." TJ
     
Moderator
Join Date: Mar 2004
Location: Copenhagen
Status: Offline
Reply With Quote
May 31, 2005, 05:06 PM
 
Originally Posted by Simon Mundy
That would create a relative link from the current folder, which wouldn't necessarily be correct.
Oops, sorry, that full stop wasn't meant to be there. Near-bedtime typso
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 07:34 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2