How to create a subpage on a website? [closed]

≡放荡痞女 提交于 2020-05-25 08:38:14

问题


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

I want to create more subpages to this page i.e.

www.example.com/faq

www.example.com/contact

etc.

I'm pretty new to web design and my current knowledge extends to making basic websites using HTML, CSS, and a little JS.


回答1:


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




回答2:


This depends entirely on your web server. Your webserver is responsible for routing URL paths to the actual content to display. However, if you just have static HTML files (professional websites tend to have HTML templates in some templating language that gets filled in with data from databases and other sources using some server-side programming language and a templating engine), most web servers will, using the default configuration, route a subpath to the "index.html" file in a directory of the same name as the path. However, this is something that does vary from web server to web server and from configuration to configuration.

In other words, for a simple website, this will usually suffice:

website_folder/
   index.html <- this is the homepage
   faq/
     index.html <- this is served from "/faq" and from "/faq/index.html"
   contact/
     index.html <- this is served from "/contact" and "/contact/index.html"

However, for a professional website, you'll find something like this to be more common:

website_folder/
  templates/
    homepage.tpl <- an HTML template in some templating system.
    faq.tpl         Examples of templating engines include Jinja2,
    contact.tpl     Django, CTemplate, though there are many, many others
  static/
  config/
  lib/
  src/
  ...

Where the webserver program (in this case I'm assuming it's under "src", but the exact organization of the code varies widely from one company to another or from one project to another) registers handlers for these different paths and the handlers are programmed to fill the corresponding templates.




回答3:


you just create another html file with the content you need and link it using an "a" tag

<a href="about.html">about</a>



来源:https://stackoverflow.com/questions/24543101/how-to-create-a-subpage-on-a-website

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!