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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With