Hi all...
Hope someone can point me in the right direction here as am stumped..
I have two domains, same name but one is .com and the other .co.za. The .com domain is 'parked' and points to the .co.za domain.
In the co.za domain my landing page (index.php) has three tabs. The default tab that shows when the site is accessed is (accom.php) and displays search fields allowing visitors to search for accommodation.
However if someone inadvertently types in www.domain.com they are receiving a sequel error as if empty fields were submitted on the search function. This is revealing my code to all and sundry.
I have spoken to my host and their reply as follows....

" I believe what is happening with the .com not showing the website like the .co.za is as a result of your web code.

I have checked that:

  1. The DNS for the .com and the .co.za correctly resolve to the same hosted server.
  2. The Apache configuration is pointing both the .com and the .co.za to the public_html folder of domain.co.za.
  3. Browsing directly to a file I created in the public_html of domain.co.za (not index.php) resolves the same:

- http://www.domain.co.za/test.php
- http://www.domain.com/test.php

This indicates that the problem is happening on a coding level.

I am still pretty new to php and have searched the web for similar errors someone else may be experiencing but have not been able to find a way to resolve this issue...
I hope i have supplied enough information for someone on this forum to be able to say what is wrong or what it is that i should do..
Best regards,

Recommended Answers

All 5 Replies

Member Avatar for diafol

Turn off errors for now if this is possible. Or code a custom error message in its place - one that doesn't give away your SQL. Use the or die().

Also you seem to be redirecting to accom.php is there any reason for not using index.php?

Hi and thanks for the reply. The redirect does go to index.php but that page itself has 3 tabs, one of which is active within index... Is called accom.php which has the search function within.
Will try the error and die() advice as well...
Thanks once again Diafol

Member Avatar for diafol

Just to say - the or die() - don't put mysql_error() into it! Just place a basic message there for now, like...

"You just arrived from the .com url. Welcome"

Sorry - off the top of my head, but anyway, it doesn't seem that this is causing problems other than the SQL running on requesting the page and displaying an error msg?

Does everything else work after that?

This should only be a stopgap measure while you investigate further.

Perhaps if you pasted any code for the index page, including the tab stuff.

Hi Diafol.. thanks so much. By going through the code carefully to do as you advised I found the error was referencing my dbconnections.php file. On going through that I found the following ...

if($_SERVER['HTTP_HOST']=='www.domain.co.za' || $_SERVER['HTTP_HOST']=='domain.co.za' (link to db)

I added additional parameters to make the link script include the .com parameter and it all works fine now.. thanks again for your time.

if($_SERVER['HTTP_HOST']=='www.domain.co.za' || $_SERVER['HTTP_HOST']=='domain.co.za'  || $_SERVER['HTTP_HOST']=='domain.com'|| $_SERVER['HTTP_HOST']=='www.domain.com' (link to db)
Member Avatar for diafol

Sweet. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.