HTML and CSS Reference
In-Depth Information
Additional customizations
Many additional customizations are provided but are commented out, as they require
careful consideration and sometimes may have unwanted repercussions.
Suppressing
or
forcing
the
"www."
at
the
beginning of URLs
Most of us do not realize that http://example.com and ht-
tp://www.example.com are treated as two separate sites by search engines. You
can either force rewriting of URLs to www or the non-www ones. I prefer the non-www
URL, because it is three characters shorter!
HTML5 Boilerplate's .htaccess file provides you with choices for doing either of
them. By default, the configuration forces the server to rewrite requests for ht-
tp://www.example.com to http://example.com . If you prefer the other way
around, have the server rewrite requests for http://example.com to ht-
tp://www.example.com , as described in the following steps:
1. Comment out the default option shown in the following code snippet:
# Option 1:
# Rewrite "www.example.com ->
example.com"
<IfModule mod_rewrite.c>
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www\.(.+)$
[NC]
RewriteRule ^ http://%1%{REQUEST_URI}
[R=301,L]
</IfModule>
2. The commented-out default section should now look like the following
code snippet:
# Option 1:
# Rewrite "www.example.com ->
Search WWH ::




Custom Search