Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2015-07-28 04:30:20

detail
Member
From: geez, I seem to be in NZ
Registered: 2010-07-13
Posts: 176
Website

serving images from sub-domain

Man, there’s a danger when someone who doesn’t really know what they’re doing gets loose inside the guts of a server.

I’m attempting to serve images from a sub domain and have been using the txptips Using TXP constants and subdomains to speed up your site rendering.

I believe I’ve set up a new sub-domain at my host. That’s at least what it says, ie, I am the proud owner of a sub-domain.

Subdomain Name: imagebank 
Folder: /imagebank
Status: Setup

I have put the images in the folder /imagebank that was created by the host.

<img src="http://imagebank.xxxxx.co.nz/imagebank/8.jpg" alt="">

does not produce an image

<img src="http://xxxxxx.co.nz/imagebank/8.jpg" alt="">

does produce an image

Maybe I’ve missed some step in there

Any thoughts there, I have a feeling it’s something quite simple.

Thanks, g

Offline

#2 2015-07-28 05:09:24

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,075
Website Mastodon

Re: serving images from sub-domain

hmmm:

A subdomain is an easy way to create a memorable Web address for unique content areas of your site. For example, you could create a subdomain for pictures on your site called “pics” that is accessible through the URL pics.example.com in addition to www.example.com/pics.

perhaps look here for clues here


…. texted postive

Offline

#3 2015-07-28 05:35:49

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,596
Website

Re: serving images from sub-domain

Try <img src="http://imagebank.xxxxx.co.nz/8.jpg" alt="">.

If you host does it anything like mine, the directory becomes the new doc root for the subdomain, so you don’t need the additional /imagebank/ in there.

Then change the ihu variable in config.php to:

define('ihu', 'http://imagebank.xxxxx.co.nz/')

Any images loaded with top’s internal functions, e.g. txp:images should automatically adjust, but you’ll also need to update any hardcoded image tags in your code. See this thread for a tip of how to do that using a variable so that if you need to change it again in advance, you just need to amend the variable.

Also note Phil’s note at the end of his instructions if you’re going to be adding lots of images to the site later.


TXP Builders – finely-crafted code, design and txp

Offline

#4 2015-07-28 05:37:57

detail
Member
From: geez, I seem to be in NZ
Registered: 2010-07-13
Posts: 176
Website

Re: serving images from sub-domain

Humm, maybe it’s just going to take 48 hours to activate. Been only 24.

Offline

#5 2015-07-28 06:01:32

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,596
Website

Re: serving images from sub-domain

Perhaps you should check your site settings in the host’s admin panel or ask your host. If xxxxx.co.nz is where I think it is, the subdomain does exist but returns a server error (i.e. without any file name). If I try that subdomain on your own homepage, I get different browser response. If you happen to have an .htaccess file in that directory, perhaps take that out to begin with. Sometimes servers choke on those if the settings in that file are incorrect.


TXP Builders – finely-crafted code, design and txp

Offline

#6 2015-07-28 06:22:30

detail
Member
From: geez, I seem to be in NZ
Registered: 2010-07-13
Posts: 176
Website

Re: serving images from sub-domain

jakob wrote #293765:

Perhaps you should check your site settings in the host’s admin panel or ask your host.

The host page says it’s set up OK. I did that this time yesterday.

If xxxxx.co.nz is where I think it is, the subdomain does exist but returns a server error (i.e. without any file name). If I try that subdomain on your own homepage, I get different browser response.

I’m getting a 500 error message. The actual site is nelsonbuildingreports.co.nz. I’m just testing the last of the images at the bottom of the only page at the moment, all the others are still coming from the original /images folder.

GET http://imagebank.nelsonbuildingreports.co.nz/8.jpg 500 (Internal Server Error)

and also with

GET http://imagebank.nelsonbuildingreports.co.nz/imagebank/8.jpg 500 (Internal Server Error)

If you happen to have an .htaccess file in that directory, perhaps take that out to begin with. Sometimes servers choke on those if the settings in that file are incorrect.

I have only one in the top level of a multihosting account.

I’ve added this exact wording to the config file at the end

define(‘ihu’, ‘http://imagebank.nelsonbuildingreports.co.nz/’)

I think I’ll wait a while just in case the sub-domain hasn’t propagated yet. I think setting up the email on the site took a couple of days.

Thanks everyone for your help, it’s dark in NZ, mid winter, time for me to take a break.

Offline

#7 2015-07-28 06:38:36

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,075
Website Mastodon

Re: serving images from sub-domain

I believe you are on GoDaddy. If so see these docs


…. texted postive

Offline

#8 2015-07-28 06:54:30

detail
Member
From: geez, I seem to be in NZ
Registered: 2010-07-13
Posts: 176
Website

Re: serving images from sub-domain

bici wrote #293769:

I believe you are on GoDaddy. If so see these docs

No secrets, hunh. Actually 5 years ago they were way cheaper than anything on this side of the world. The interface has improved a lot recently as well. The problem is it doesn’t cost me anything to add websites, I’ve got 7 currently crammed on my multi-hosting territory.

Probably best to host this one closer to home rather than ping everything from NZ to Arizona and back.

I think the following may be the issue, I’m impatient. It says it’s ready, but it might not be.

NOTE: DNS can take up to 48 hours to propagate.

Thanks for the info bici, I have followed it, well, all but that last line.

Offline

#9 2015-07-28 08:22:59

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,137
GitHub

Re: serving images from sub-domain

detail wrote #293771:

NOTE: DNS can take up to 48 hours to propagate.

It’s like 2006 up in here.

If your DNS is hosted at GoDaddy, there should be almost zero delay. The name servers for your domain can take up to 3 days to propagate everywhere around the web, but if you’re adding a subdomain to an existing domain there are no changes at the global name server level, just an extra line in the DNS at GoDaddy.

I’m inclined to +1 what jakob said – GD have a system (or they used to, at least – may do still, dunno) where subdomains live inside the web root, which is bloody stupid not to my tastes. That said, this domain1 does resolve, but with a 500 error. Other random subdomains at *.nelsonbuildingreports.co.nz don’t resolve, so it’s not DNS.

Check the file permissions on the uploaded image(s) – set to 755 if it’s not already like that.

Edit: also, a 500 error should throw an error into the error log – does your hosting have that info available?

[1] http://imagebank.nelsonbuildingreports.co.nz

Last edited by gaekwad (2015-07-28 08:27:16)

Offline

#10 2015-07-28 09:07:08

detail
Member
From: geez, I seem to be in NZ
Registered: 2010-07-13
Posts: 176
Website

Re: serving images from sub-domain

gaekwad wrote #293772:

If your DNS is hosted at GoDaddy, there should be almost zero delay.

That’s great to know.

So maybe it has something to do with the way that the hosting is offered. I’m on a multi-hosting package, I can add any number of websites for nothing. None of them are particularly heavily trafficked, I only get about 1000 hits a day on a good day for all the sites, it’s not so dramatic.

The structure is a top level domain with all the other sites run as aliases, basically in subfolders of the main domain. When I checked the list it shows only one domain, cycletrailsaustralia.com, a few other aliases which are operational websites, and one sub-domain which is called imagebank.nelsonbuildingreports.co.nz.

Somehow the path is being lost with the multi-hosting arrangement. When I added the sub-domain yesterday a new folder was created within nelsonbuildingreports.co.nz, good that I called it something unique like /imagebank.

I did try just using http://cycletrailsaustralia.com/reports/imagebank/8.jpg as the address, I picked that up from Coda, ie, the ftp, and that works. Do you think that using that would be OK in the long term? It’s all in the same bundle anyway and I only want sporadic loading of the nelsonbuildingreports.co.nz site, maybe a few times a day. It would be unlikely that anyone would notice much difference.

What do you think, it doesn’t really matter where else the images pop out from.

g

Offline

#11 2015-07-28 09:11:20

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,011
Website GitHub Mastodon Twitter

Re: serving images from sub-domain

Did you try to temporarily rename the htaccess file? the 500 is usually caused because of that.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#12 2015-07-28 09:16:54

detail
Member
From: geez, I seem to be in NZ
Registered: 2010-07-13
Posts: 176
Website

Re: serving images from sub-domain

colak wrote #293776:

Did you try to temporarily rename the htaccess file? the 500 is usually caused because of that.

Y

No I haven’t touched that.

I did do this —

Then add the ihu variable at the end of the config.php to:

define('ihu', 'http://imagebank.nelsonbuildingreports.co.nz/')

Hey, thanks everyone, that’s fantastic support.

g

Offline

Board footer

Powered by FluxBB