Page 1 of 1

Site linking in a portable manner:

Posted: Tue Feb 24, 2009 6:45 am
by Crayon Shin Chan
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?

Re: Site linking in a portable manner:

Posted: Tue Feb 24, 2009 7:48 am
by Master Kenobi
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?

Re: Site linking in a portable manner:

Posted: Tue Feb 24, 2009 7:52 am
by steelcity_ballin
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?

Re: Site linking in a portable manner:

Posted: Tue Feb 24, 2009 8:37 am
by Crayon Shin Chan
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/)