Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create Subpage in html [closed]

Let's say I have a website http://www.example.com

How do I create more subpages to this page i.e.

www.example.com/faq

www.example.com/contact

etc.

like image 641
Calico Avatar asked Jul 03 '14 00:07

Calico


People also ask

How do I create a subpage in HTML?

1) Open your website folder and locate the page that fits best for your new sub page – open each page in browser and see the layout. 2) Copy and paste the page selected in the same folder, rename it. Use English characters and numbers for page titles. 3) Open the new page in your HTML editor and edit it as you need.


1 Answers

You'll need to create new HTML files called faq.html and contact.html for this instance. Then you can link to these pages with <a> tags.

EDIT
After half a decade, this answer has started getting upvotes, while not being as complete as the longer answer here. Here are some more details:

When you create extra HTML files and visit them, you'll see that the URL also contains the .html-part. This is something most people don't want. Provided you're using a webserver (either local or with a third-party host), there are multiple ways to get rid of the extension — one of which doesn't require server-side scripts and has been documented in Stephen's comment below.

What you do, is you add folders with the appropiate names (faq, contact, etc.). Once you have the folders set up, all you have to do is put index files inside them (index.html). Those index files should contain the content for their respective parent folders.

In essence, this is repeating the process with which the root location of a website is created, but for subfolders. You see, oftentimes you start out with a root folder called public_html, in which there is a single index file. Webservers automatically serve index files:

public_html/index.html     -> example.com/index.html
                           -> example.com/

public_html/faq/index.html -> example.com/faq/index.html
                           -> example.com/faq/  ←  😎

As you can see, when done, you can visit

www.example.com/faq

Instead of

www.example.com/faq/index.html

Just like how you can visit

www.example.com

Instead of

www.example.com/index.html

If you feel like you want more fine-grained control, you're better off using server-side scripts. Whatever server language you use, you are in total control over where people navigate and what they get to see, no matter what the request looks like.

If you're using an Apache server, you can take a look at what an .htaccess file is, though writing and debugging them is arduous IMO.

like image 133
Gust van de Wal Avatar answered Oct 06 '22 22:10

Gust van de Wal