There are several ways to serve files without an extension.
One of the easiest is to use the Multiviews option in your .htaccess. That option allows the /webpage.html
document to be accessed through the /webpage
URI. Then you can use a rewrite rule to make sure that the version with .html gets redirected to the version without the extension. Here is the .htaccess:
Options +MultiViews
RewriteEngine On
RewriteRule (.*)\.html $1 [R=301,L]
Another way of doing it is having your entire site be handled by a single script that prints the correct page based on a parameter, and then use .htaccess to rewrite everything into that script. Here is the .htaccess for that approach.
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /thescript.php?s=$1 [L]
Many content management systems (CMS) such as Wordpress name your URLs for you, and have settings for the style of URL that you wish to use. In Wordpress this can be controlled under "Setting" -> "Permalinks" where there are several options, none of which use the .html extension. I also use the custom permalinks plugin that allows me to specifically choose the URL that I want for every page.
As for your question about the number of pages on your site, it is common practice to have separate pages for contact.html
, about.html
, privacy.html
, and faq.html
. I could see merging contact information with "about us" information, but I wouldn't try to put everything in one page, it gets too long.
do something in one main index.php
differently than @StephenOstermiller - it sounds to me as though you want a common header/footer/etc for those pages, but don't know how that could be done, so that part ended up phrased oddly. Is that it? – Izkata Mar 6 '13 at 19:05header.html
, and insidecontact.html
(assuming you can run PHP in it)<php include('header.html'); ?>
. – Izkata Mar 6 '13 at 19:35