Hi, This may be a silly question, or I feel at any rate that the answer should be more obvious, but I am wondering how to set up a site so that the links do not include the ".html" file extension. I.e.: mysite.com/blog
and not:
mysite.com/blog.html
I've previously been developing within Wordpress and so this happened automatically, but how does one do this for a stand alone site. Some methods that I've come across already are: setup a series of folders each with their own index.html files, or add the following lines to .htaccess:
RewriteEngine on RewriteBase / RewriteRule ^(.+)\.html$ $1 [L,NC,R=301]
Do people here have a sense of what's the best method?
# Redirect to HTML if it exists. # e.g. example.com/foo will display the contents of example.com/foo.html RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}.html -f RewriteRule ^(.+)$ $1.html [L,QSA]
This may be a silly question, or I feel at any rate that the answer should be more obvious, but I am wondering how to set up a site so that the links do not include the ".html" file extension. I.e.:
mysite.com/blog
and not:
mysite.com/blog.html
I've previously been developing within Wordpress and so this happened automatically, but how does one do this for a stand alone site. Some methods that I've come across already are: setup a series of folders each with their own index.html files, or add the following lines to .htaccess:
Do people here have a sense of what's the best method?
RewriteEngine On
# Redirect to HTML if it exists.
# e.g. example.com/foo will display the contents of example.com/foo.html
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.+)$ $1.html [L,QSA]