View Full Version : Cgi-bin results same from domain and sub-domain

01-15-2006, 09:36 AM
Recently I set up a subdomain on my website. I also worked with WestHost to install a script in my CGI bin. We agreed to keep the CGI-bin at the root and just link it to the sub-domain. This is how it looks:


The sub-domain:
var/www/html/sub-domain/ (I can see the CGI-BIN link off of the sub-domain.)

FYI the Sub-domain is pointing to a folder within my main domain structure.

So with everything set up and working and Google finally coming to visit I'm noticing some strange things. When I click on some of the pages that Google visited (from my FastStats program) they go to:


instead of:


The page displays properly but the URL looks like it is coming from the domain and not the sub-domain. The domain is another store altogether that does not utilize a CGI-Bin directory.

Is this a limitation of my FastStats Analyzer program that the links are going to the domain or is Google really indexing these pages as if they were from the domain and not the sub-domain?

Is the fact that I can get to my products from both the subdomain.domain.com/cgi-bin and the www.domain.com/cgi-bin an indication that something was set up wrong?

I read in another thread about setting up a sub-domain so that the sub-domain and the regular domain to not know about the other. I believe this was accomplished through the use of another directory.

Thanks for whatever help you can give me.

01-15-2006, 02:49 PM
I don't see how Google would know to link to the cgi store script except via your subdomain if all the links are on your subdomain. I think it may be your FastStats Analyzer that is doing this.

01-15-2006, 04:16 PM
Thanks for the response. I'm still waiting for the FastStats tech support to contact me (it's been three weeks now) but I will ask them about this.

The thing about this whole thing is that I can reach a product page in my store which resides on the sub-domain via my browser. If I change the sub-domain to www the page stays the same!


Adding the product directories to these and they both take me to the same page. The domain is a separate line of business not utilizing a CGI-BIN so I'm really starting to think my sub-domain was set up wrong. Alternatively, can I create another CGI-BIN in the sub-domain instead of linking to the main CGI-BIN?


01-16-2006, 08:22 AM
Yes you can set up a cgi-bin for you sub-domain that is seperate from the one the main domain uses. It would involve editeing your httpd.conf file though (something that WH does not support or encourage). Have you worked with this file in the past? Here is the relative Apache help page on this subject: http://httpd.apache.org/docs/2.0/howto/cgi.html You might also want to have a look at your current httpd.conf file to see how your cgi-bin for your main site is set up. /ect/httpd/conf/httpd.conf

Just a quick note. The name of your new/second cgi-bin does not have to really be cgi-bin. It could be called scripts, cgi-bin2 or anything else. The set up of the ScriptAlias that is mentioned in the above link I gave you (that you would put in your sub domain) could be cgi-bin even if the "real" name of the directory it points to is not. The reason I say this is that you could set things up like this:

/var/www/script - This would be the actual directory for your sub domain cgi scripts.
Then the ScriptAlias would be set up like this

ScriptAlias /cgi-bin/ /var/www/script/

03-06-2006, 02:59 AM
Because of the way you have your subdomain set up, you will be able to access all of it as http://www.domain.com/subdomain/

If you want to keep the two (sub)domains entirely separate, then make sure that your subdomain is pointing to a different branch of the directory for example var/www/html for the main domain and var/www/site2 for your subdomain.

Then follow Wild Joker's hints and tips or separating the cgi-bin out

The sub-domain:
var/www/html/sub-domain/ (I can see the CGI-BIN link off of the sub-domain.)

FYI the Sub-domain is pointing to a folder within my main domain structure.