php_Guy Posted October 17, 2008 Posted October 17, 2008 I decided that I would like to reorganize my site before it goes live. Currently, the main site is at mysite.com and the store is at mysite.com/store. I want to create a subdomain and put the store at store.mysite.com. Fortunately, I have not bought my own ssl yet (using the host's shared ssl atm) so no penalties there in relocating. Apparently, as far as seo goes, a subdomain is preferable to a subdirectory. I was about to make the move and then it occured to me that I don't know if subdomains have their own DNS entries. If they don't, I would suspect that each and every reference to store.mysite.com would generate a DNS lookup that would point to mysite.com which would then send back a redirect to store.mysite.com which means unnesseccary slowdowns on page loads. Does anyone know? Do subdomains have their own DNS entry?
maxxxie Posted October 17, 2008 Posted October 17, 2008 I decided that I would like to reorganize my site before it goes live. Currently, the main site is at mysite.com and the store is at mysite.com/store. I want to create a subdomain and put the store at store.mysite.com. Fortunately, I have not bought my own ssl yet (using the host's shared ssl atm) so no penalties there in relocating. Apparently, as far as seo goes, a subdomain is preferable to a subdirectory. I was about to make the move and then it occured to me that I don't know if subdomains have their own DNS entries. If they don't, I would suspect that each and every reference to store.mysite.com would generate a DNS lookup that would point to mysite.com which would then send back a redirect to store.mysite.com which means unnesseccary slowdowns on page loads. Does anyone know? Do subdomains have their own DNS entry? Subdomains have their own entries. For instance, in DNS, you would have a number of NS and SOA records that deal with the parent domain mysite.com. At the simplest level, you'd then create an A record for store.mysite.com (and, if you must, www.store.mysite.com). If you want to get complicated, you could delegate DNS records for store.mysite.com to another DNS server, but I think that's probably overkill. Apache, or whatever web server you use, would need to know how to deal with requests to store.mysite.com. You'd have to modify the apache.conf or httpd.conf (whichever applies) to tell apache where the files are located for the web site at http://store.mysite.com/. You'd typically create a separate directory structure for the files that are stored in the subdomain. Eg for mysite.com your files might reside in /var/www/domains/mysite.com/httpdocs, whilst for store.mysite.com, you'd store the files in, say, /var/www/domains/mysite.com/subdomains/store/httpdocs. Then tell Apache that store.mysite.com is located at /var/www/domains/mysite.com/subdomains/store/httpdocs. So - there is more to it than simply adding records in DNS, though that is obviously the first step. You also need to reconfigure your web server. There's probably other stuff that needs doing. I can't give you much more advice, I rarely deal with subdomains. Cheers, Max
Guest Posted October 17, 2008 Posted October 17, 2008 Hi, I have to say I don't have too much experience with subdomains but I use a fairly unimportant subdomain on one of my sites and I've noticed that some of the cheaper hosting providers don't actually use subdomains, they use a sort of frame which looks like a subdomain but isn't a true one - just thought I'd give you a heads up on that. A problem that came up for me is that it uses URL masking whereby any link out from this subdomain masked where it went next - this can obviously cause a bit of a problem with search engines indexing URLs. I guess you'd have to ensure all shop links were absolute (I didn't have my shop there, just some basic html pages). Anyway - this might not be relevant to you but I thought I'd give you a heads up just incase. Fasthosts is the hosting provider I'm specifically referring to though others may do it too.
jermcel Posted October 17, 2008 Posted October 17, 2008 Another way you could do this is by using Mod_Rewrite. I use this myself and it works fantastic. Use what ever ftp or ssh program you use (I use winscp for my windows machine), navigate to the var/www/.htaccess file, open it for editing, then add the following text (of course adding your own sites and folders to the url's). <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{HTTP_HOST} ^store.yoursite.com$ [NC] RewriteRule ^(.*)$ http://yoursite.com/oscommerce/catalog/whatever/etc$1 [r=301,l] </IfModule> Save the edited file, then go to your domain registar and add an A record for store.yoursite.com to the same IP address and then Apache will use the above rule to reroute to the correct files on the server. Mod rewrite becomes a very powerful and useful tool, and it can do a lot of other things as well. Google it to find more uses. Hope this helps Jeremy
php_Guy Posted October 17, 2008 Author Posted October 17, 2008 Thanks for the replies. I don't have control of my own server so I need to rely on my host for some of that. I'll be sure to ask them if they use real subdomains or some sort of masking/rewriting. I didn't realize any hosts were using some other method.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.