about SUBDOMAIN vs SUBFOLDER question again? - subdomain

I am planing to create a site,
where my root domain www.example.com has an index page where it will let the users CHOOSE 3 website
namely politics.example.com , games.example.com, news.com
or example.com/politics , example.com/games, example.com/news?
now, I dont know what to choose? a SUBFOLDER or SUBDOMAIN linking?
what i would like to happen is that whatever the click-rate from one of my link, it will be passed to my root domain which is example.com. is that possible?

If you are using a subdomain, for example: subdomain.example.com, requests will be sent to subdomain.example.com, and not to example.com unless you program to do so explicitly. Clicking example.com/subdomain sends requests to example.com.

Related

Content Delivery Network configuration - CakePHP

I want to use Cloudfront to serve images and CSS for my cakephp website. I would like to just host the files on my host and use cloud front to speed up delivery of said files, I dont know how to proceed?
Till now I have created a distribution on CloudFront with my Origin Domain and CName and deployed it.
Origin Domain: example.com CName cdn.example.com
I added the CNAME for my domain:
cdn.mydomain.com with destination xx.cloudfront.net
Do I need to update the links in my HTML to that cname so if the stylesheet was http://example.com/app/webroot/css/style.css do I change that to http://cdn.example.com/app/webroot/css/style.css
You can go through and update your links to point to the CDN you would have to do this for every image and CSS/JS that you are serving from your CDN.
Another option would be to create a redirect in your .htaccess, perhaps something link this?:
RewriteRule ^css/(.*)$ http://cdn.mydomain.com/css$1 [R=301,NC,L]
I'm no .htaccess wizard so don't just copy and paste and expect it to work, but it should give you an idea of what you could do.

Website Redirect Alternative - Two URLs to use same code base

Currently I have a redirect setup in my domain host's dns for example2.com to goto example.com
I don't want it to redirect but rather stay as example2.com while displaying the exact content from example.com. I don't want to copy the site's code between the two. I want a single code base and both URL's to use the same code.
I am not sure how to achieve this using my web host's CPanel. I thought I might be able to do it using cnames or aliases but that does not seem to work. I am sure someone has had this experience before.
I believe this is a pseudo-programming question but if a mod decides this is the wrong stack please do move it.
303 headers need to be sent with a new domain or in this case example.com, for apache or php related steps see these links:
http://www.inmotionhosting.com/support/website/htaccess/redirect-without-changing-url
redirect to a page without changing the url
Redirecting to HTTP error documents without changing the request URL
For explanations:
http://en.wikipedia.org/wiki/URL_redirection
http://en.wikipedia.org/wiki/List_of_HTTP_status_codes#3xx_Redirection

Pointing a subdomain to an existing page on its domain (webpage it exists on)

How can I create a subdomain that points to a page on the same webpage?
Such as:
sub.mywebpage.com to:
mywebpage.com/foldera/folderb/pagename
You will need a webserver which will redirect requests for sub.mywebpage.com to the other url. This cannot be done using DNS alone.

What is the part of a URL before the domain name called?

So I have 2 questions:
What is this part called? en.wikipedia.org, the part before the domain name.
I wanted to make something like that for my website, like firstName.lastName.web
For my personal page on my family web site.
How do I do that? I know that if I just put a folder in the root folder, its treated as a /. Like so: lastName.web/firstName.HTML. That's fine, but not what I wanted.
It's called a subdomain. Creating a subdomain varies on who you have your domain name registered to. A quick google search should be able to solve this for you.
In DNS it may be considered a sub-domain - in general this position is the hostname.
In your example this isn't even a hostname - it's just the language prepended.
Like this translations of multilanguage sites get separated ('en' is quite the default).
Usually this is all the same virtual host - just with different language resources.
Just create a sub-domain called *.yourdomain.com to enable wildcard DNS.
Nowhere did I see this spelled out in layman's terms, so here goes.
I own a bunch of domain names, and here's one that is parked, right now: violetweedconsulting.com.
The DOMAIN NAME is violetweedconsulting.com, that is also the 'root domain', it includes the TLD extension.
The ".com" is the TLD extension of that example domain name.
Some other potential TLD extensions are ".edu", ".org", ".net", ".ca" (for canadian domains) and of course TODAY there are a lot more TLD extensions, but primarily, for most uses, those basi ones are all you'll use in the USA.(UK has co.uk, and Australia has co.au, etc.)
Subdomain: The 'www' that comes just before the domainname.com is an example of a 'subdomain', or 'third level (the 'period' . is a separator character).
If you are a newbie, think of the 'www' as a file folder name. If you had a website, you could be (though not always) an 'administrator' for that website on your hoster's website. Then you'd have a login to, for example, www.godaddy.com and you would thus have a login to godaddy's hosting area for your website. On that hosting site you'd have the ability to add different 'folders' like 'search' or 'blog'. The search folder might have a search-engine page (I wouldn't bother with that folder but some sites do, if they have a lot of data, for example). The 'blog' folder would be where your blog posts would go, and you can also redirect a wordpress.com (or .org) or a blogger.com to the subdomain blog.domainname.com, so that you can use the subdomain 'www.domainname.com' for whatever you want and the blog subdomain just for your journaling. There's more info available, but that's the gist of it. www is a filefolder, so is blog., etc. and each subdomain can be 'restricted' to specific users with logins, etc.
That part is called the subdomain.
More generally speaking, here are the different parts of a URL, as per window.location. (So at least according to how Javascript calls it)
protocol://username:password#hostname:port/pathname?search#hash
-----------------------------href------------------------------
-----host----
----------- origin -------------
protocol - protocol scheme of the URL, including the final ':'
hostname - domain name
port - port number
pathname - /pathname
search - ?parameters
hash - #fragment_identifier
username - username specified before the domain name
password - password specified before the domain name
href - the entire URL
origin - protocol://hostname:port
host - hostname:port

difference between http and www

pardon me for asking a very basic doubt.
I have hosted a page in the site collinfo.annauniv.edu
The page opens fine when i enter the address as http://collinfo.annauniv.edu
But when i gave www.collinfo.annauniv.edu my browser shows 404 error.
What is the difference that http causes here in place of www.
The www. before your domain is actually a subdomain. It's essentially the same thing as help.microsoft.com or orders.amazon.com.
With that in mind, there are a few things that could be happening:
1) Your DNS records do not include the appropriate A Record for the www subdomain.
In this case, you'll need to setup an A record that points to your web site's IP address. If you don't know how to do this, your web host should be able to help.
2) Your server is not configured to handle the www subdomain.
If you're using the apache web server, it needs to be configured to show your web site when the user enters www before your domain. Again, your web host can set this up for you.
It all comes down to a misconfiguration issue. If you don't have experience administering web servers, you may want to give your web host a holler.
www comes from the (rather) old time where a domain had several sub-features, of which the web was not always the main service. For instance
www.domain.tld for web
mail.domain.tld for mail
ftp.domain.tld for ftp
domain.tld for web
but this is a convention - any subdomain may point to anything actually.
This is more a question of DNS declaration and/or web-server configuration ; in this case it is probably that the web-server configuration does not trigger the same pages for www.domain and domain (since you get a 404).
The author / administrator of collinfo.annauniv.edu either forgot to create a DNS entry for www.collinfo.annauniv.edu or did not create a virtual domain (web-server side) for it that would point to the same pages as collinfo.annauniv.edu.
HTTP is a protocol.
http://collinfo.annauniv.edu
Is the address of a resource which can be retrieved using HTTP.
annauniv.edu is the domain in your case.
collinfo is the subdomain.
www.collinfo is also considered as a subdomain but it does not exist. That's why you get HTTP 404 not found.
Subdomain can be anything, www is usually used as it usually mean World Wide Web.
WWW is a subdomain
HTTP is a protocol (language)
Whether you specify HTTP in the browser or not, the browser will always assume the request is being of "http" type and will ussually add http:// for you.
WWW however is just an alternative subdivision of the domain name, the same as in:
www.domain.com
site.domain.com
sub1.domain.com
sub2.domain.com
.....
etc.domain.com
In most cases the WWW subdomain will point to the same "page" as the main domain, which is usually called the "index" page, such as index.html, or index.php and in most cases the index page is hidden in the browser's address bar, unless you specifically type it in, such as http://www.yahoo.com/index.html, but you have to understand that if you have a full control of your webserver you can modify these, so WWW doesn't point to the same page or you can call you main page "home.html" instead of "index.html" and instruct your webserver to "point" your browswer to that page by default.
But things like HTTP are not easily changed, since HTTP is the main language of the web and most browswers use that as the primary means to access the webservers.
Peace!