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

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.

Related

it is posible to get anotehr address from using pre-name on url?

If for example I have site call
xyz.com
how can I force my server(Asp.net/iis)
to go to another page if i ask for
a.xyz.com
it is posible?
for example: m.xyz.com leads to xyz.com/mobile.aspx
thanks!
The solution involves multiple steps:
You need to configure the subdomain in your DNS.
You need to create a website in IIS to handle the subdomain. There's a guide here on how to do this. Pay attention to the "Host Header" part - That's where you set you m.xyz.com address.
You need to setup an HTTP redirect (301 / 302). You can do this from the config file with the httpRedirect element (More details here).

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.

second domain and '/'

Let's say I have a domain a.com and a subdomain a.a.com
The folder of the subdomain is inside the main domain's folder, so accessing a.com/a/ is the same as accessing a.a.com.
If an image in index.php of the subdomain has url(/a/a.png) instead of url(a/a.png), when I load the subdomain a.a.com,
will there be any chance that I would download the image from a.com/a/a.png instead of a.a.com/a/a.png and result in an error?
I tested. It is safe to do so.

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!

about SUBDOMAIN vs SUBFOLDER question again?

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.