Assigning pages to domain names

I have a question about domains.

Say that I have a page on my computer called ‘main.html’ If I upload it to the site, how do I assign ‘main.html’ to the domain (say ‘sitepoint.com’)?

That is, how might I assign my webpage to a certain web address?

Thanks.
~TehYoyo

That is, how might I assign my webpage to a certain web address?

Just to be clear, you can’t assign a web page to any web address. You generally need to own “sitepoint.com”, get a hosting account that will be setup for use with that domain name, change the domain’s nameservers so that “sitepoint.com” points to the host’s server, upload the main.html file to the hosting account as instructed by your host (typically in the “public_html” folder), and, after the domain propagates, you will be able to visit your page by typing “sitepoint.com/main.html” in a browser.

So then is it impossible to display a website with the web address ‘sitepoint.com’?

I think yeah, it’s impossible to display it, so what should we do then?

Dunno, mate. I’m in your boat, if you’ll pardon the expression.

We need the input of an expert here.

~TehYoyo

Yes … unless you wanted to set this up on your own computer in a local environment that no one else sees. The sitepoint.com domain is owned by SitePoint and is used for their website. Why are you asking this question? What are you trying to achieve here?

No the sitepoint.com thing was purely theoretical. I was just using that particular domain name as a common example…lol I’m not going to do anything malicious or anything like that (not to mention that I don’t have that skill set or anything close). Sorry if there was a misunderstanding.

I was just wondering how I could do it for my own website.

So, if I get you, the only way to display a webpage on a certain domain name is to have a dedicated server that I own?

Thanks.
~ModYoyo

So, if I get you, the only way to display a webpage on a certain domain name is to have a dedicated server that I own?

No, that’s not what I meant to say. Perhaps I misunderstood you.

The general advice remains to get a domain name for your site, and a shared hosting account. A shared hosting account is not a dedicated server, it’s just an account on a dedicated server, hence the “shared” bit.

You can host the site on your own computer if you really want to, but that means you have to keep it on 24/7, and the bill alone will probably make it not worth the effort. I know that some people use XAMMP (http://www.apachefriends.org/en/xampp.html) to host on their own computer. As far as I know, it’s by no means secure enough for the purpose, but that doesn’t detract some people. :slight_smile:

It is not possible to use someone else’s domain name to host your site/content, without their permission.

Ah, lol, it’s amazing how easily confusion can arise!

If you have your own domain, it will need to point to a publicly accessible hosting account. So, you buy a domain name from a domain hosting company (like GoDaddy). Then you also need a publicly accessible computer somewhere on which your website files are stored. Normally, you’d pay a web hosting company a small fee per year to rent some hosting space on one of their specially set up computers. If you are a bit of a geek, you can actually set this up on a computer at home, but you have to have that computer running 24/7 etc.

Once you have a hosting account, you can use a free program to upload your files to the hosting computer, and then people will be able to view your website at your domain name on the web.

That’s not a very detailed explanation, so if it’s not clear, just shout, and I (or someone else) will explain further. :slight_smile:

Yeah. I got most of that (previous experience and the Build Your Own Website The Right Way book).

My question is, once I’ve uploaded my files (ie. via Filezilla, etc.) how do I assign main.html to ‘www.mydomainname.com’ instead of having about.html bet that web address?

Thanks.
~ModYoyo

Hm, not exactly sure what you are asking. If you upload about.html to your main (root) folder, that page will be viewable at [noparse]http://www.mydomainname.com/about.html[/noparse], and main.html will be available at [noparse]http://www.mydomainname.com/main.html[/noparse].

If you want one of those pages to be viewable simply at [noparse]http://www.mydomainname.com[/noparse], then rename it to index.html. If you don’t specify an actual page when you type in your domain name (e.g. you just type [noparse]http://www.mydomainname.com[/noparse] into your browser) most web servers will look for a file called “index” to display by default (e.g. index.html or index.php). Some servers will also be happy with home.html.

So if you want main.html to appear when someone types in your domain name, just rename it to index.html.

Does that help? :slight_smile:

Does help a lot. :smiley:

Thanks a ton.
~TehYoyo

You’re welcome. :slight_smile:

Just to add, I don’t really like any page to have a .html extension. Rather than a URL like this:

[noparse]http://www.mydomainname.com/about.html[/noparse]

I much prefer URLs like this:

[noparse]http://www.mydomainname.com/about/[/noparse]

You can easily do this by creating a new folder called “about” inside the main root folder. Then move your about.html file to that folder, and change its name to index.html. Then you’ll be able to view that page at [noparse]http://www.mydomainname.com/about/[/noparse], which I think is a lot neater. It can also be a lot neater to organize your pages into folder like this.

Ahhhh. I was always wondering about how people did that.

Thanks a ton!

~TehYoyo

You can change main.html to index.html and make it yoursite.com. That is the easiest method without going through all the trouble of other methods.

The easiest method is index.html/htm renaming mentioned above.

If you want to change it to be some specified file without having to name it index.html then you have to change the server’s index, if you have cpanel it’s as easy as clicking Index Manager in the advanced section. If you do not have cpanel the only semi-universal way I’m personally aware of is altering the .htaccess file with:

DirectoryIndex main.html

You can also get more complicated with .htaccess and do some other things like url rewriting to hide submission data or file types but, at this point that’d probably be a little much so I’ll leave it at that.

If at all possible just renaming the file is recommended.

Great. I’ll make sure to rename it. Thanks all.

~TehYoyo