How to add a web page directly onto domain? - html

Sorry if this isn't the appropriate place to ask this question, as it doesn't pertain directly to code, but I haven't found any help anywhere else.
So I've created a temporary landing page for my website that's just an .html file. I've uploaded it onto the host's public_html directory. In order to access that page I need to go to example.com/test.html. However, I'd like to be able to access that page by just going to example.com.

You can do this by adding this content to .htaccess file in public_html directory
RewriteEngine On
DirectoryIndex test.html
replace test.html with your file name

it's entry page, for whole entry pages, you should use naming index.html, rename your page to index.html

Related

How to use the index.html I've designed as the home page of a Wordpress website?

I am designing a portfolio site for a client. I am using Semplice template for Wordpress as it is supposed to be a good theme, but the thing is that is not so customizable as I would like, so I've designed the home page with HTML, CSS and JS on my own, with no templates. So I want to use the index.html I've created only for the home page, and Wordpress+Semplices for the rest of the sections of the website.
Now, I've already uploaded the Wordpress content and database to the host, and it's working. I am uploading my HTML+CSS+JS through the CPanel, but I here comes the problem:
I can upload my files to the root directory of the Wordpress in the public_html folder. If I do it, It keeps using the index.php (which charges the wordpress index, that I don't want), unless I delete this file and leave only the index.html that I've designed, in which case it runs my index but it doesn't loads the rest of the Wordpress even if I write the links to the sections properly. So it looks like this default index.php charges the rest of my wordpress them, and if I delete it, it won'g load anymore.
So, to conclude, I need something that charges both of them, the index.php which will load the rest of the wordpress sections (work, about me, info, etc.) but that uses my index.html as the default home that appears when I write the URL in the browser.
I will show you the files of my public_html folder, just in case it can clarify something for you to help me and understand me better:
By the way, as you can see in the image, I have no .htaccess file in my folder. That's confusing. What's the reason?
The .htaccess file can be not visible, try unhiding it in your File Manager -> Settings -> Show hidden files. If it's still not there, you can create .htaccess file yourself.
After that, it should be an easy redirection with the .htaccess file as this:
RewriteRule ^$ http://example.com/path-to-html.html [L,R=301]

Directory Redirect to HTML Document not working

On a website I have a directory service-name which I don't want people to have access to, since it just stores css files, images and pdfs. Further more, in a different folder on the site, at the web root, there is a page service-name.html.
To stop the directory listing, in the service-name folder, I have included a .htaccess file and an index.html file.
Within the .htaccess file I have put Options -Indexes to disable the directory listing, and then put in RewriteRule ^index.html http://www.example.com/service-name.html [R=301,L]
So in short I am trying to redirect the search for the directory to a root level html page. It is not working though. I get a blank page with the service-name directory, which I guess works adequatley because my desire to stop people accessing a directory has come to fruition, but it does not redirect straight to the desired page, which I thought it would have if I included the index.html page in the directory and redirected that?
But when you search for service-name/index.html that redirects properly, so I have clearly missed something! A sharp prod in the right direction would be of use!
Thanks

Wordpress website redirects to "index.html" which doesn't exisit

My Wordpress website, www.the-family-historian.net, goes directly to /index.html, which doesn't exist. I have it set in the Wordpress backend so that the landing page is the posts (blog) and not a static page, but this "index.html" seems to be blocking it. Thanks for any help!
Try setting the following at the top of the .htaccess file:
DirectoryIndex index.php
This should force any request to go to index.php first and ignore index.html, not a 301 redirect though.
Using an FTP program, or possibly a web based file manager, view the files that make up your website. Find an option to view "system / hidden files" in order to view the .htaccess file. I suspect you will find a rewrite rule in it pointing to index.html Simply change that to index.php and all should be good.

how to display first page in localhost?

I am using Xamp to create a website, I am having a folder named HTML which has a page called Cart.html, the folder HTML is found in htdocs and I want Cart.html to appear as soon as localhost is being input in the browser. That is when I input http:// localhost/, the Cart.html page should appear. I am unable to do, can u suggest me how to do it.
Simple HTACCESS rule:
Redirect 301 index.html Cart.html
Assuming they are in the same folder, otherwise replace with whatever needed
Rename the cart.html to index.html & put it in htdocs as 'htdocs/index.html'
You can create a .htaccess file with the following contents. The only problem here is that any sub folder will look for "Cart.html" as its default page
DirectoryIndex Cart.html
If you do not need the index.html file at all, I recommend deleting it and putting this DirectoryIndex instead
DirectoryIndex index.html Cart.html
This will cause all folders to look for "index.html" first and if it doesn't exist it will use "Cart.html"

How to execute a HTML file on my homepage?

I just created a basic html file and want to upload that file to my website.
So what I've done is, went to cpanel->file manager->/htdocs and uploaded the file(sandy.html).
But the problem is it's not executing on my home page( i.e. sandeep.0fees.net). It's just showing the file that I uploaded.
I think you'll understand better when you see my website.
Where I'm going wrong? What should I do to make that file to run on sandeep.0fees.net instead of sandeep.0fees.net/sandy.html?
Rename your file to index.html
Or call it directly http://sandeep.0fees.net/sandy.html
Try renaming it index.html. There is a setting called a default document and that is the file that is loaded when you end the url without a filename.
If you want it to be the default landing page, call it index.html instead.
You can also add this line to the .htaccess file, in the public_html folder:
DirectoryIndex sandy.html index.php index.html
If it doesn't exist, create it! :)