Hosting Your Own Website

Acquiring Your Domain and Hosting Service

The first thing you will want to do is acquire a domain. There are plenty of website to do this through, but for this blog we will talk about GoDaddy.com. I find it is good practice to find a domain name that explains what your website is. If it is a personal portfolio site, your name would be a great domain name. If you are running a business and want to build a website for it, see if that name is available. Unfortunately, since there are so many domains out there, some may already be in use, so be prepared to compromise possibly by adding a symbol such as www.firstname-lastname.com or www.firstinitial_lastname.com. You can of course try to buy a domain from its owner, but that could be a long and expensive process.

Scroll down to see your Web Hosting option and click Manage
Click on the black cPanel Admin button
Click the first option, File Manager

Editing Your Website

Now the fun begins. To host from your website, all you need to do is simply look for your public_html folder, and start writing code in the index.html file! And congratulations, you are hosting and editing your own website!

Inside the public_html folder

Deploying Your React App

First, when you are comfortable with your React application, run the command $npm run build. This will create a build folder that encompasses the elements of your application and prepares them for deployment. This may take some time, so be patient.

The Build folder has a nested static folder with three folders nested inside of that
Upload under the navbar, outlined here in red

.htaccess

There is one final and important step to take when deploying a React app to cPanel, especially if you are using BrowserRouter or any other routing system. On your cPanel file manager, go to the top right of the page and click on settings. There will be a box towards the bottom of the window that pops up that says “Show Hidden Files”. Click this checkbox and save the changes. Now the .htaccess file will be visible, as it is set to not visible by default. Click on the .htaccess file and edit it, and enter the following code:

You’ve Done It!

If you follow these steps you will successfully launch your first website hosted from your domain, and hopefully much quicker than I did. Be sure to make sure you copy only your files from your build folder, and do not try to move entire folders into your cPanel (certain memberships do not allow full folder transfers). Now go forth and publish your website!

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Aidan McBride

Aidan McBride

I ‘m a Web Developer and a Flatiron coding bootcamp alumni. I currently work in the financial tech industry as a Front End Engineer