📌 Click Here For Best Offer on Server: http://www.hostinger.com/thapa7 ❤ ❤ For Thapa Family Use Special Discount Code: THAPA7 or THAPA15 ❤ ------------------------------------------------------------------------------------
Want to host your React app on shared hosting without buying a VPS? 🤯 In this video, I’ll show you the complete step-by-step process using Hostinger — from building your React app to uploading the dist folder and fixing the most common 404 error using .htaccess.
💡 Perfect for beginners and developers who want a simple & affordable deployment method.
👉 Comment "LINK" to get access to my React Live Class Recordings at a minimal price. -----------------------------------------------------------------------------
⌛TIMELINE⏳ 00:00 Host React App on Shared Hosting 00:20 No VPS Needed (Save Money 💸) 00:45 Build Your React Website 02:00 Understanding the dist Folder 02:30 Hostinger Shared Hosting Overview 03:45 Hosting Dashboard Walkthrough 04:10 File Manager Explained 04:25 Upload dist Folder to public_html 06:15 Common Problem (404 Error on Refresh) 07:50 Fix Using .htaccess File 09:12 .htaccess Code Explanation 10:35 Important Links & Resources 10:40 React Online Classes (Recordings)
Hello, what's up, guys?
In this video, you can see this awesome React e-commerce website.
How can you host it on shared hosting?
I'm going to share it with you.
And there is a problem you will almost certainly face.
And that is the routing issue with your React application.
When you host it on shared hosting.
How can we fix it?
I'm going to share it with you in this video.
Yes, guys. This video is important because, finally, you don't need to buy a VPS.
Just to host your React application.
This project is simple.
This is the final project of the online courses we are taking at Codifier.
It's simple.
But if you make it yourself.
I think you're ready as a beginner.
You will do it.
You will do something yourself.
Because there is a lot in it.
So, without any further delay, let's start the video.
So, first of all, you can see that I have come to my VS Code editor.
Okay.
And here you can see that this is the code of my application.
So, now you fully understand that when you create, it's part of your development, right?
But when you have to host, then we have something called the production version.
Right?
And what have you been using lately?
We are using Vite.
And if you have installed React through Vite or are working with it.
So, it is very easy to create the production version of the application you have made.
Like if I had to run this application.
I type npm run followed by dev.
So, this is my application.
You can see that my port 5173 is running there.
But this is on my local system.
I have to host it.
For that, we need a production one.
So, for that, your command is here.
One second.
Okay.
Let's stop it first.
Okay.
I run npm run here.
And then you have to write build instead of dev.
By the way, if you go to the package.json file, you will also find it here.
So, Vite by default gives you this script.
Through which you can easily build your React application.
So, the instant you execute this command.
So, it creates a dist folder for you.
You can see that this file has been created.
By the way.
Right?
You can see it here.
And if you look here.
So, we have one new folder.
That's your district.
And this is the folder you just need to copy.
You have to paste it into your shared hosting.
And your work will be done.
Now, how does it happen?
I will tell you.
So, this is your dist.
In which you can see.
We have assets.
Whatever your files are.
Or whatever it may be.
You have an HTML file.
And a wit.sbg.
Simple.
Now, this folder is the main one for you.
Okay.
Now, we have to go directly to our browser.
First of all.
If you don't have any shared hosting.
And if you want my recommendation.
Then I suggest we go with Hostingo.
Because I have been with them for the past 5 years.
Right?
And I don't know how many are with me.
So, guys.
I will show you here.
On services.
You will receive multiple.
Click on just web hosting.
And here you can see.
So many.
Don't go alone.
You won't enjoy it.
Go with premium.
Minimum.
Okay.
Click on Choose Plan.
So, you will see an interface like this.
Free email
Free domain
Free SSL certificate
24/7
Chat support
And a 30-day money-back guarantee.
So, there is no problem.
You will be given multiple options.
For how many years?
Or even one month.
Never forget one month.
Go with a minimum of 1 year.
Okay.
If you just want to take a look.
And we have this.
Have a coupon code.
THAPA7
And then apply.
So, you will receive an additional 10% discount.
On existing discount.
That's really awesome.
And I have one more coupon.
If you go above 2 years.
THAPA15.
Then, guys.
You will receive an additional 15% discount.
On existing discount.
So, this is really awesome.
Okay.
So, definitely apply this.
I've provided the link in the description.
And in the comment section.
Click on it.
And when you come.
Apply this coupon code.
So you get the best value for money.
You will receive the best discount.
Alright.
Once this is done.
Then you can claim the domain for free.
Then you will see this kind of interface.
Okay.
By the way.
You can see something like this.
I have many of them.
So, this codify.online.
I will go here.
I am clicking on the dashboard.
Okay.
You will also see the dashboard.
You just click on it.
And when you see something like this.
Here, keep in mind.
The main is this part.
That's your file explorer.
If you have a dynamic website.
Then you can easily create a database here.
So, that's the file manager.
You have to go here.
There is a folder inside this.
By default.
That's your public underscore HTML.
And I was talking about this.
See this here.
So, you can see.
Whatever is inside this.
Guys.
Simple.
Control A.
And delete it.
So, do one thing here.
You can see this.
Upload icon
What you have to do on this.
Click on it.
Okay.
Click here.
Click on the folder.
By the way, now.
See, I'm already in that folder.
This is my main folder.
I am inside this folder.
I will click on upload.
But before that.
If you don't have an idea.
In which folder is your project located?
Then I highly recommend doing so.
Like a simple type explorer.
And then a dot.
So, the instant you type this.
So, your folder structure.
I mean.
You will receive the route.
Copy it.
Right.
Whatever was here.
Come here.
On top.
And paste it.
So, look at this.
It came.
Click here.
Then click on upload.
So, click on upload.
So, you can see.
In a matter of seconds.
Your database.
Now, what happens is.
The public underscore HTML.
Within this.
You need the complete content.
Right.
Right now.
It has a disk folder.
The content inside the disk folder.
I need it there.
So, here you go.
Basically.
Move it directly.
That is also better.
Here you can see.
This option.
Which you can see.
Right.
The move one.
Click here.
Double click on this.
So, now you.
Public_html
See.
Currently navigating.
On this particular part.
Right.
I'll move it.
I will refresh it.
My work is done.
If I click here.
So, see.
Inside this.
All my files.
And folders have arrived.
Now, I.
You can see.
Codify.
Online.
Right.
I moved here.
I refresh it.
So, 3.
2.
1.
And.
Boom.
Guys.
See.
I haven't done anything.UnitTesting
I have not made any edits anywhere.
There is nothing anywhere.
Within 6 minutes.
I think 6 minutes.
Or 5 minutes.
This video is done.
My work is done.
My products are finished.
There is nothing on the card.
So, nothing will happen now.
I have to go.
And by the way.
Guys.
I have done a lot of things.
But on this.
I haven't pushed.
On GitHub.
That's why.
You're feeling a bit ordinary.
But.
So much.
It's all there.
Enough.
More than
Right.
So, my work is done.
Now.
What I was doing.
A major thing.
And that's.
The most important thing.
Which many people.
Don't realize.
And that is.
That react.
It is a single-page application.
SPA
Right.
So, this will happen.
When you are on the about page.
Now, here.
If you find the about page.
Very simple.
So, let me tell you.
This is a React online class.
The final project.
Is that?
Not of CSS.
Okay.
CSS.
Whatever you want to make.
Do it.
For us.
Here.
Its functionality is paramount.
That's why.
But.
What I am going to show.
Listen to it carefully.
Now.
I am on the about page.
Okay.
The moment.
I refresh this page.
See what happens.
This is it.
This will be the problem.
This page.
Does not exist.
Because.
When you create.
Through a React application.
You React Router.
Which package is yours?
You know the library.
You use that.
And that's your client side.
Routing
But when you.
Host the React application.
In shared hosting.
So.
In shared hosting.
Mostly you.
Apache
Which is the server?
It sees.
It stays.
Okay.
So, this happens.
When you go to the about page.
Okay.
Right now.
I am on localhost.
When you go to the about page.
And refresh it.
So.
The server of shared hosting.
It checks behind the scenes.
That's about the folder.
Is there in your project?
Or not.
In ours.
There is nothing about it.
There is only index.html.
And React is yours.
SP.
Single page application
Right.
It will be about.
But in the form of.
Component
It is somewhere.
But we have only.
index.html
So, now.
What should we do here?
Because.
This problem.
Has become a major problem.
That.
Nobody.
Even.
Leave this.
When.
If you.
Okay.
See.
Now.
No one.
This product page.
Won't come.
Till.
Now.
On the home page.
By yourself.
Manually.
I won't go.
Till.
Won't come.
Even cart.
If I refresh the cart.
This will go too.
So.
It has only one solution.
And that is.
We need one new file.
Whose name is?
Hypertext
Access configuration file.
By default.
You don't get it.
So.
You have to do this.
We have a new file.
Option here.
Okay.
Click on it.
Here.
.ht
Access.
The name of this file.
Should be here.
By the way.
Okay.
Create it now.
Okay.
I created it here.
Now.
Here.
By default.
I have kept it.
So that my students.
I mean.
Whoever is learning.
They.
Easy.
I have pasted it here.
Control.
S.
Save.
You must have noticed this here.
It has been saved.
But still.
Click once again.
Close it.
Okay.
Now.
I am going to the homepage.
I came to my senses.
Sorry.
This is localhost.
Okay.
I come here.
I went home.
Okay.
Iículo to about.
A little while ago.
My page was not accessed.
When I refreshed.
And boom.
Guys.
See.
My work is done.
Means.
Now.
You don't need a VPS to host a React application.
In a simple shared hosting.
So easily.
Now.
You can host your React application.
Live.
You can show in front of the world.
Or.
You can create a resume.
Now.
You can host here.
You will also receive free versions.
Many free websites.
But.
Your own domain.
So much power.
You're not going to make it there.
Okay.
I know.
Guys.
Now.
It will come to your mind.
That.
I have written such code in .htaccess.
Due to which.
The routing problem.
It was solved.
So.
This is the code.
Guys.
See.
Here.
This is the code.
Here.
You have.
In this.
You understand.
This line.
And then.
This line.
We are saying.
Listen.
The way.
You used to handle routing.
Now.
The way.
You need to adjust it slightly.
Whatever I say.
You have to agree.
We are saying this to shared hosting.
Okay.
So.
What did we do here?
First of all.
This is a line.
Pay attention to this flag.
So.
Imagine here.
The user has typed the name of such a file.
Which does not exist.
Means.
Not a file.
It is not a valid file.
Then.
Here.
Again.
Requesting.
Something like this.
Which is not a valid directory.
Means.
The folder's name is not present.
Okay.
It is not a valid file either.
Of our application.
Nor is it a valid directory.
Of our application.
So.
If both of these conditions.
Are satisfied.
Then.
We are saying.
Do one thing.
That user.
Now.
Our.
Index.html file
Home page
There.
Redirect it.
That's it.
So.
This was the sole purpose of our code.
Invalid file.
Or.
Invalid directory.
If anyone has typed anything.
Redirect them to the homepage.
And.
Once.
If it comes to the homepage.
Then.
By default.
Your React Router.
I'll take care of it.
And see.
If a forward slash is about.
It will render the about component.
Forward slash is cart.
It will automatically render the cart.
We just had to somehow.
Go to the home page.
And.
Through this code.
We are able to do it.
This is it.
So.
Once more.
I have provided the link.
In the description and comment section.
I have sent the coupon code.
Click there.
And.
If any of you
Want my react.
Online classes.
Recording videos.
Then.
Write in the comment below.
Only link.
I will share the link.
And.
There will be a small.
Minimum amount.
You can pay and access it.
It will be a lot of fun.
But.
I hope you liked the video.
Where did you get to know?
That React application.
How can you?
Host it live.
So.
Yeah, guys.
This is it.
For today's video.
If anyone has any doubts.
Please comment.
And tell me fst
I will definitely help you.
Please like the video.
Like the targetème
500 likes.
And our next target is.
800,000 subscribers
If you haven't subscribed yet.
Please do it.
See you in the next video.
See you guys then.
Thank you so much.
Be careful.