Site linking in a portable manner:

From Visual Basic to GNU C, this is the place to talk programming.

Moderators: SecretSquirrel, just brew it!

Site linking in a portable manner:

Postposted on Tue Feb 24, 2009 6:45 am

My host, which happens to host my blog for free, has quite a couple of domains. Last time, ikimashou.net was bought over by a squatter, and even though my blog was still running at dasaku.net, the image and resource links all pointed to files on ikimashou.net. I've thought a bit about changing all the links in my blogposts to /wp-content/uploads/(date) instead of http://ritchan.dasaku.net/wp-content/uploads/(date) so that in case dasaku.net is unavailable or I wish to move my content elsewhere, I won't be dependent on a single host.

Is this good practice, or is there another way? Because I imported the posts to my local XAMPP installation, and whenever I use the relative path /wp-content/uploads/(date), it forgets that it's actually at http://localhost/wordpress/ instead of http://localhost... thus breaking it again. Any fixes?

Also, is there a quick and easy way to go through my year's worth of posts and replace all the links?
Mothership: Thuban 1055T@3.7GHz, 12GB DDR3, M5A99X EVO, GTX470+Icy Vision Rev.2@840/3800, Vertex 2E 60GB
Supply ship: Sargas@2.8GHz, 12GB DDR3, M4A88TD-V EVO/USB3
Corsair: Macbook Air Ivy Bridge
Crayon Shin Chan
Minister of Gerbil Affairs
 
Posts: 2250
Joined: Fri Sep 06, 2002 11:14 am
Location: Malaysia

Re: Site linking in a portable manner:

Postposted on Tue Feb 24, 2009 7:48 am

For any web code you really dont want to be using hard links with domain names in them, unless your linking to an external source. If its part of your website use the paths according to the arrangement on the FTP server. I'm not sure I fully understand what your doing with the XAMPP local install. All the website files should be on your FTP server, unless your hosting this locally?
i7-920 @ 4.20GHz | Biostar Tpower X58 | 4870 1GB | 3x2 DDR3-1600 OCZ Gold Modules | Windows 7 Ultimate x64 | 4x 1TB Black WD Hard Disk Raid 1
Master Kenobi
Gerbil First Class
 
Posts: 121
Joined: Wed Aug 15, 2007 9:08 am

Re: Site linking in a portable manner:

Postposted on Tue Feb 24, 2009 7:52 am

It sounds like you are having a pathing issue between your development locally and your deployment remotely given your last few sentences. I haven't used wordpress at all so take that for what it's worth, but if the folder structure is the same locally and remotely, you should be able to access any files using a relative path. Absolute pathing should be used sparingly because it causes too many problems with file management, scalability, updating etc.

Could you better explain the relationship between the ikimashou.net domain and the ritchan.dasuku.net domain?
Corsair 600T | ASUS P8P67 PRO | Intel 2500k @ 4.4Ghz | EVGA 560 TI | G.SKILL Ripjaws Series 8GB | Corsair HX650 650W
steelcity_ballin
Gerbilus Supremus
Silver subscriber
 
 
Posts: 11924
Joined: Mon May 26, 2003 5:55 am
Location: Pittsburgh PA

Re: Site linking in a portable manner:

Postposted on Tue Feb 24, 2009 8:37 am

ikimashou.net and dasaku.net are different pages, but ritchan.dasaku.net is just the same as ritchan.ikimashou.net.

As for the XAMPP install, what I meant was for ritchan.dasaku.net, the root folder in that case was htdocs/wordpress, so when I FTP in, I go straight to the directory which contains Wordpress's files. For my local XAMPP installation, the root folder is htdocs. Thus, when I pass a relative link in my XAMPP installation, it looks in htdocs/wp-content instead of htdocs/wordpress/wp-content. I was hoping there's a function to return a link relative to Wordpress's installation folder, not relative to whatever the web server specifies (in this case, htdocs/)
Mothership: Thuban 1055T@3.7GHz, 12GB DDR3, M5A99X EVO, GTX470+Icy Vision Rev.2@840/3800, Vertex 2E 60GB
Supply ship: Sargas@2.8GHz, 12GB DDR3, M4A88TD-V EVO/USB3
Corsair: Macbook Air Ivy Bridge
Crayon Shin Chan
Minister of Gerbil Affairs
 
Posts: 2250
Joined: Fri Sep 06, 2002 11:14 am
Location: Malaysia


Return to Developer's Den

Who is online

Users browsing this forum: No registered users and 3 guests