Are you a Google Analytics enthusiast?
Share and download Custom Google Analytics Reports, dashboards and advanced segments--for FREE!

www.CustomReportSharing.com
From the folks who brought you High Rankings!
More SEO Content
Wildcard Subdomains
#1
Posted 24 December 2004 - 02:35 PM
They appear to be a hot little topic with hosting companies because they boast unlimited subdomains and all of that. When you want to make them work, they tell you to search google. Thanks. I have been to the end of the internet and back, but finally got a lot of help from a javascript expert who wrote some code. They all work now.
Keep in mind, I understand that there are a variety of different ways to control or redirect these wildcard subdomains, javascript only being one of them. Also keep in mind that these subdomains are NOT created in the DNS records.
So if you're not familiar with the wildcard issue, it basically works like this (the way I understand it) Start with domain.com. If you were a special client, I could give you a subdomain like yourname.domain.com
I simply enter a new line in the redirect script and tell it what page to go to. Now, even though it's a subdomain, it is only a wildcard subdomain, so when you enter yourname.domain.com, in the browser address bar, you may see something like:
yourname.domain.com/subdirectory/somepage.html
and that's fine, because it maintains yourname in the address bar before the rest of the URL.
Also keep in mind that with wildcard subdomains, if there is no redirect script, or a particular subdomain redirect is not listed in the script, it will always resolve to the home page. Therefore, although there may be a redirect for yourname.domain.com, you could still enter anybody.domain.com (without any redirect provided) and that would resolve to the home page. The neat thing is that with the redirect, I can make it go to any page I want.
So like most projects, you always seem to run into the low bridge at high speed, right?
In order to get this redirect to work properly and consistently (like from a link in an email message; link in a site; or just typing it in a browser) I have had to make the following changes:
1) index.html has been changed to home.html
2) index.html is really nothing more than a javascript redirect that includes specific redirects for subdomains; plus the meta tags; plus one meta tag line for the robots to follow home.html.
The root directory of the site also includes a robot text file. It was created to eliminate the so called bad robots, but I have since been informed that the bad bots don't read the robot text. Oh well, just another low bridge, right?
Anyway, the heart of the question is will this basically blank index.html (structured the way it is noted above) hurt search engine ranking?
I have some very specific needs for the wildcard subdomains, however they are NOT the main focus of the site. In short, the concept can be dumped if it's a fact that search engines will not follow the index and the rest of the site. If this works, then we potentially add a new income stream to the site.
I thank you all in advance for taking the time with this. Your comments are appreciated, and I will respond.
#2
Posted 24 December 2004 - 03:51 PM
End of the Internet eh do you mean here ? (popup blockers off first)
Well after all that. there is only one thing to point out. crawlers don't follow javascript redirects and treat them with extreme suspicion. So if the intention is to get any of the wildcards subs spidered this way you'll be SOL, as the crawlers will come to a halt on the default page for the hostname.
Wilcard domains/subdomains should really be used in conjuction with Host Headers for IIS or VirtualHosts for Apache. At the very least 301 redirects should be used. There is no need to change the default page as whatever is the default doc for the server will be used.
some hosting companies like them because it saves them having to really know anything about DNS other than creating the wildcard.
BTW. technically wildcards subdomains are created in DNS by using a A record in the zone file that looks like this;
*.domain.tld. 14400 IN A xxx.xxx.xxx.xxx
something to be aware of if any wildcard subs are to be used for email, DNS PTR records have to created as reverse lookup needs to be available for many mail server spam filters or RBL filters.
#3
Posted 24 December 2004 - 03:53 PM
That said, if you're relying on a Javascript Redirect to get the search engine spiders to your sub-domain that's not going to work. They generally ignore JS.
A DNS solution would be far better IMO. Many hosts these days will allow that type of control over your local DNS. I gather that's not possible with your hosting solution. A combination of server side scripting with some mod_rewrite rules might solve the problem too, but that's a lot more work than a simple DNS tweak.
<added> Chris is obviously much faster than I am today.
#4
Posted 24 December 2004 - 04:34 PM
Thanks for the warm welcome and the trip to the very end of the internt. Have to pass that one on.
As I do with just about any web issue board I post to, talk to me like I'm a three year old. As it is, I am almost over my head in this computer stuff. Matter of fact, had a big party the day I got a cgi script to fire off forms. Wow! So you see, there are simple things (to you guys) that amuse me.
Now, this wildcard thingy.
Sorry if I didn't make it clear. I am NOT worried about spiders following the subdomains. I am not concerned if they get indexed. It is really an opportunity to
do a few tricks.
Consider this. We host a free listing directory for an industry. People in the industry leave their information, and we post it according to state, country, etc.
Now, because a lot of the people in this particular industry do NOT have web sites, we wanted to offer an upgrade for the free listing. Therefore , we could promote something like yourservice.domain.com. The redirect allows us to point the subdomain to their specific page. Of course, that's easier for them to advertise/promote or say to anybody than somedomain.com/directory/yourservice.html.
So in short, not worried about spidering the subdomains.
My only concern is this. Currently, the site INDEX.HTML is a blank page with the redirect script for the subdomains. The main page of the site has been renamed as HOME.HTML.
Like I said, included in the index page meta tags is a robot message to follow HOME.HTML. The root has robot text file.
Will the HOME.HTML get spidered (along with the rest of the site) with this configuration? (Being that INDEX is a blank)
Trying to stay away from all that complicated stuff that you guys do so well.
By the way Chris, thank you for correcting me about the wildcard subdomain things.
Peter
#5
Posted 25 December 2004 - 07:37 AM
Assuming for a moment that you're on a *nix server there's a much easier way to make home.html the default page for your site and completely do away with the redirect. You can do it with an .htaccess file.
Here's how.
1. Open up any old text editor and type in the following two lines:
Redirect 301 /index.html http://www.yoursite.com/home.html
3. Make sure to change the "yoursite" above to be your actual domain name.
4. Save that as a file called .htaccess (Yes, it really starts with a period)
5 Upload that to your server at the same location where you home.html page current resides.
Ta Da! You're done!
Let me take a moment to explain what that will do...
Basically, you're letting the server do what servers do best. The first line is telling the server to send anyone who goes to www.yoursite.com/ to your home.html page. The default setup is usually index.ext, so we're simply telling the server that your index.html is actually home.html
The second line is just a failsafe in case someone tries to go directly to www.yoursite.com/index.html. If someone does that, the server will automatically redirect them to your home.html file, while at the same time providing a 301 Permanently Moved server response to let everyone know that the file has moved.
#6
Posted 25 December 2004 - 10:20 AM
Thanks for your help on this. For the record, the site it on a *nix server.
I understand the concept of .htaccess files. It just that I've never played with them once I understood that a slip of the wrist could effectively lock everybody out of everything. So I try to leave complicated issues alone.
Now I understand what your suggestion does. My question is, what happens to the wildcard subdomains? Does the current index.html page (with the redirect) handle them, or do they get added to the .htaccess, or what?
Once again, they aren't the most important part of what I am trying to do, but they would be very helpful.
Thanks again for your help.
#7
Posted 25 December 2004 - 10:23 AM
Considering the current set up with the index page being the redirect, it DOES have a link to the home.html page. That was assuming the spider gets to index, it will follow the link to home.
Sorry, that should have been added from the start when I was describing the current set up.
#8
Posted 26 December 2004 - 09:25 AM
As I understand it, the subdomains are all being retrieved using a javascript routine. For good or ill, the search engine spiders simply aren't going to follow those generally speaking. I know that Google was looking at a way to follow some JS links, and there was a rumor that MSN may be able to parse some javascript too, but I've not done any recent testing to see if any of that is true or not.
If you were using a combination of Chris' DNS for subdomains and the htaccess above to get from index.html to home.html everything would get spidered. But I wouldn't count on anything that goes through a javascript function getting spidered. In the past it never has.
#9
Posted 26 December 2004 - 11:31 AM
Thanks again for your support on this. I have a quick question.
That I understand. But in order to use the wildcard subdomains, it relies on the (now current) index.html for redirection. So if I add the .htaccess file which (to my understanding) sends everything to home.html, then what will happen when somebody enters somename.domain.com ?(Assuming somename is set up in my js to redirect to a particular page).
Because if everything goes to home.html, it defeats the purpose of the js script redirect. (Again, not worried about the subdomains being spiderd; only want them as an added feature)
Also, you should know that originally, (before creating this index for redirect and renaming the old index to hoome) the js redirect was on the index. For some reason, the server didn't like that. Either causes an error or the page actually loaded before any redirect, which really made things confusing.
Thanks again!
Peter
#10
Posted 26 December 2004 - 12:30 PM
Let me lay out what I think I'm understanding now so that we can (hopefully) help you to design a workable solution to the problem.
If this doesn't get us there it might help us if you could post the javascript redirection code you're using so that we can see what it's doing. Feel free to remove the domain info and make sure to use the code button so that everything doesn't turn into semi-live links. Or if you would like simply PM the url address of your site, we'll figure out something that is workable.
Here's what I think I understand...
- Your index.html page is set up with a (META Refresh ?) redirect to your home.html page so that the JS subdomain redirect will work.
- On your home.html page it sounds like you're using JavaScript to determine if someone is trying to go to one of the sub-domains or not.
We'll also need to know if you have any server side scripting languages available to you. Given that you're on a *nix system, the most likely of those is probably php. It should do the job just fine.
If you're not sure if PHP is available to use, stick the following in a test file and upload it to your server. Then pull up the file in your browser. If anything displays you have PHP available to use.
phpinfo();
?>
Armed with enough information I'm sure we can come up with a solution to accomplish what you want to. And make it both visitor and search engine friendly.
#11
Posted 26 December 2004 - 02:13 PM
Almost there. But, I think you have it a little backwards.
Let me try this:
1) INDEX.html = js for all SUBDOMAIN redirect + META tag to have robots follow HOME.html + LINK to HOME.html.
2) HOME.html is the main page (what I used to call index.html)
The JS on the index (which is where you land by default, right?) looks for any subdomain. If there is no subdomain, you get home.html loaded. IF there is a subdomain, then you get redirected to that page. Keep in mind I am not worried about spidering the subdomains.
If I do this right, here is the js on INDEX.HTML
(I included everything from the META tags down)
//**** enter your domain below
domain='MYDOMAIN.com';
//^^^^
path=location.pathname.substr(1);
h=location.hostname;
i=h.indexOf('www.');
if(i>-1) {
i=h.indexOf('.');
h=h.substr(i+1);
}
i=h.indexOf(domain);
h=h.substr(0, i-1);
loc='';
//**** set subdomain names and directories below
if(h=='store') loc='/_store/storeopen.html';
else if(h=='links') loc='/links/linkpage.html';
else if(h=='coolprofits') loc='/_sponsor/coolprofits1.html';
else if(h=='colinavey') loc='/_store/storeopen.html';
else if(h=='imcool') loc='/_ebook/affebook/imcoolconsumer.html';
else if(h=='kool') loc='http://www.anotherdomain.com/index.html';
//^^^^
if(loc) {
if(path) {
loc=loc.substr(0, loc.lastIndexOf('/')+1);
path=path.substr(path.indexOf('/')+1);
}
location=loc+path;
}
else location='home.html';
//-->
</SCRIPT>
<TITLE>Auto air conditioning repair, service, recharge and retrofit information</TITLE>
</HEAD>
<BODY>
<P>
<P>
<P align=center>
<A href="http://MYDOMAIN.com">MYDOMAIN.com</A>
</BODY></HTML>
I won't have a chance to try the php or anything else until later today. Thanks again for all the help!
P
#12
Posted 28 December 2004 - 11:55 AM
You could also do away with the redirect to home.html if you wanted. Just have the JS redirect fire off before your normal HTML code. That might be a cleaner solution all the way around actually, since it would remove the META Refresh element from the mix.
I would do it a bit differently, using server side scripting so that it wouldn't depend upon the user having javascript enabled. But that's neither here nor there.
#13
Posted 28 December 2004 - 01:26 PM
Thanks for your help on this. I really appreciate it. The one thing I found with these wildcard subdomains is that there are a bunch of ways to make them happen. The method with js means I don't have to go to school to learn a bunch of things... I just add to the script in my HTML editor.
You should also know that we originally tries a script on the main page (when it was index.html and there was no home.html.) Two problems made it difficult:
1) In some cases, it appeared that a 'race' was going on where if you entered the sbudomain one time, you would get to where you were going. The next time it would return a bunch of scribbles on the screen. E-Mailed hosting company, they said they tried it... it worked... basically you're on your own.
2) With a change in the js, it seemed that the entire page would load before redirect. Therefore, if I supplied you yourname.MYDOMAIN.com, the entire index page of MYDOMAIN.com would load before you saw yourname.MYDOMAIN.com. It was long enough that you could click another link on the index before the redirect.
My biggest concern is that this script will NOT hurt search engines. By the sounds of your last post, I should be OK. So now
Thanks again for all of your help. If it is of any value, I don't mind sending you (directly) the site info and subdomain list if you feel like playing around with it.
Have a great, safe and happy New Year!
Peter
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users








