Behaviour of domains and subdomains for accessing a URL - web

Why does analytics.google.com works while www.analytics.google.com does not ??

David's comment above is accurate. I wanted to expand upon this a little to clarify your thinking of www.
www. is a subdomain like any other. Whether you use analytics. or www. or whateveryouput., they're all still just subdomains that are created for the domain in question.
David answers correctly that the reason www.analytics. doesn't work is because the subdomain analytics. doesn't have a subdomain www..
I think it's important to know that there's nothing particularly special about the www. subdomain compared with any other subdomain.

Related

What is the correct way to name a subdomain?

It is about naming URLs, for example www.example.com/pagename and www.pagename.example.com.
Are they under the same domain name? if so, I don't understand why some websites choose the second option (www.pagename.example.com) for some of their pages instead of keep going with the 'normal' way (www.example.com/pagename).
Are there any advantage or disadvantages of adding the name at the beginning of the URL?
Simply speaking, www.pagename.example.com has subdomains www, pagename and example. There does not appear to be an index/home page specified.
www.example.com/pagename has subdomains www, exmaple. It has a page name in this case specified as it is / forward slash after top level domain.
In answering your question, well that depends on your needs. If you have separate sites or areas of interest "domains" then you can divy it up but still be under one domain mysite.

.htaccess: Point Secondary Domain to Primary's Subdirectory

I have two domains on a VPS server, the primary "domain1.net" and the secondary "domain2.com". The website I have currently set up for domain2.com resides at domain1.net/subd1/subd2. I'm trying to create a rewrite rule for my .htaccess file so that whenever someone visits the site "domain2.com", "domain2.com/index.php", it grabs the page from "domain1.net/subd1/subd2", "domain1.net/subd1/subd2/index.php". I would like to do this while keeping "domain2.com" intact in the web address, instead of moreover redirecting it, and have all images/links appear from domain2.com.
From my understanding, it seems .htaccess's rewrite rule would be able to do such a thing, I just haven't figured out how the syntax would work. However, if there's a superior alternate method, I wouldn't be opposed to hearing it.
I appreciate anyone's help on this issue.

WWW works, no www does not work

Quick domain question:
A clients site: www.workingwardrobes.org, does not work if I take off the www. .Someone told me that I have to do a DNS change and add the non www. with the same ip as the www. However, can't I just fix this with some sort of htacess?
Unlikely. If the non-www URL isn't hitting the server, it won't hit your .htaccess and that's what it sounds like is happening.
Unless you do a dns change you can't do this. But after you have done that you can redirect www version to non www version or vice versa.
It looks like you have a DNS entry for both www and non-www (maybe you just added it). Anyway, they both work. However, you should really pick one as the "standard", for seo reasons and just to be consistent. You can do this with .htaccess rules.
There are many questions and answers here on SO, such as:
Generic htaccess redirect www to non-www
This discusses both ways, depending which one you want.

cname issue with hosted ecommerce

Having a bit of an issue with a store that has just been set up with shopify. The problem is with cnaming the domain into the shopify subdomain. I have www working just fine so www.no1gadgetstore.co.uk cnames to no1gadgetstore.shopify.com. However, http://no1gadgetstore.co.uk does not resolve and I can't set up a cname for a non www record.
Does anybody have a simple solution to this, as everything I've come across so far is too complicated to even try.
Many thanks
Dave
From one of our support guys:
sounds like he just needs http://no1gadgetstore.co.uk to be a URL redirect to http://www.no1gadgetstore.co.uk - the CNAME should only be on the www. address.
For more on this, check out http://wiki.shopify.com/DNS

Htaccess.. changing the domain name

I have a big Joomla website that was moved from .com to .eu domain.
The sites are on one web server.
On the old website there are a lot of links that point directly to oldwebsite.com/somethinghere.
Is there a way with Htaccess file in the old domains folder to redirect
from oldwebsite.com/somethinhere to newwebsite.eu/somethinghere?
Or maybe a way to do this on the new website folder?
Thank you,
Chris.
There are many ways, some people recommend using RewriteEngine, but there is an easier way:
Redirect 301 / http://domain.eu/
This will automatically handle files in the domain -- for example, old.com/foo will be redirected to new.eu/foo
EDIT: Regarding "301", that is the code for a permanent redirect. There also exist temporary redirects (I believe the code is 302), but it sounds like what you need is exactly this - a permanent redirect.
EDIT2: Oh and, I think the / after domain.eu may be required, but I'm not 100% sure - doesn't hurt for it to be there, that's for sure! I know that because I use the same kind of a redirect on a production website.

Resources