New page in html

1

Let's say I have a site called site.com.br, and two HTML files. One called index.html, and another, sub.html. I would like to make the index.html file stay on the site as only site.com.br and sub.html stay as site.com.br/sub.html .

How can I do this? Thanks in advance.

    
asked by anonymous 10.05.2017 / 04:24

2 answers

1

Gabriel,

By default, each server will identify the index.html file and reference it automatically as a home page and any other page would come at the end of the address, as /sub.html . It is possible to set up more details and could give you an example, but for this you would need more information on which server you would be using. I'm waiting for more information to help you better!

    
10.05.2017 / 15:23
0


I will assume that the site is already on a web server (it can be with localhost). Home If the server is Apache it is very easy to resolve this. Just create or modify the .htaccess file in the root of the site (where index.html is located) with the following code:

 RewriteEngine On
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule ^(.*)$ index.html/$1 [L]

If you do not know how to do this, I recommend you to change index.html to index.php and use the following code in .htaccess :

>
 RewriteEngine On
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule ^(.*)$ index.php/$1 [L]

Please note that rewrite must be enabled on the server (for default is). It may also happen that you are not using Apache and it is already out of my knowledge area. I hope I have helped: D

    
10.05.2017 / 11:28