Included JavaScript causes "Premature end of script headers"

My web page, top.html, includes the following line:

<SCRIPT LANGUAGE="JavaScript" SRC="../cgi-bin/putdisplay.js"></SCRIPT>

Now there are two ways to call top.html, without or with subdomain. Without subdomain,  the URL is

and everything works nicely.

If I call the same top.html using subdomain:,

I get the following error message, "Premature end of script headers: /home/dralex2/public_html/albumwizz/cgi-bin/putdisplay.js". In that case, top.html is displayed correctly, but the JavaScript is not included.

Any ideas?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Michel PlungjanIT ExpertCommented:
That is because the js files are not found and return

<title>500 Internal Server Error</title>
<h1>Internal Server Error</h1>
The server encountered an internal error or
misconfiguration and was unable to complete
your request.<p>
Please contact the server administrator, and inform them of the time the error occurred,
and anything you might have done that may have
caused the error.<p>
More information about this error may be available
in the server error log.<p>
<p>Additionally, a 404 Not Found
error was encountered while trying to use an ErrorDocument to handle the request.
<address>Apache/1.3.27 Server at Port 80</address>


which is invalid
Michel PlungjanIT ExpertCommented:
and later I get
Error: parent.frames.topFrame has no properties
Source File:
Line: 62

and Line 10

on the first url
Michel PlungjanIT ExpertCommented:
when clicking on the index
Become a Certified Penetration Testing Engineer

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

ZvonkoSystems architectCommented:
If you open you will see that nothing is working correctly.
Repair that virtual server configuration first.
Afterwards should be your JavaScript included correctly for both domain names.

Good luck,

Michel PlungjanIT ExpertCommented:
It is so strange that so many sites do not handle the domain name without www
karnovskAuthor Commented:
Well I think I have the answer.

Apparently, the web server is configured so that each top level cgi-bin directory can contain only CGI files. Whatever file it meets, be it .js or .gif, it attempts to execute it.  All .htaccess settings are ignored. That's what happens when I use the subdomain, cgi-bin becomes a top-level directory. Hence all the "Premature end of script headers." messages.

When I don't use subdomain, i.e. use URL, cgi-bin becomes a lower-level directory, and my .htaccess setings start working.

Therefore, the practical solution was to move out all non-executable files out of cgi-bin. It worked!

Best regards and thank you all for your efforts.

Michel PlungjanIT ExpertCommented:
post a question in community support and ask them to PAQ and refund, please
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

PAQ with points refunded

Please leave any comments here within the next seven days.

EE Cleanup Volunteer
PAQed, with points refunded (500)

Community Support Moderator

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.