Need help with htaccess rewrite

design

#1

Hello fellow DreamHosters,

I have a blog that I’m writing: outinsacramento.com

The blog is the primary home page and the natural folder structure of the posts (which I can’t change due to the software I’m using) is not conducive to SEO or sharing links.

Example:

I would like to use .htaccess to allow me to rewrite this link as:

outinsacramento.com/lowbrau.html
or
outinsacramento.com/lowbrau/

Or worst case:
outinsacramento.com/posts/lowbrau.html`

Is this possible and if so, how would I write that command in my .htaccess file?

Thank you!


#2

Probably something like this:

RewriteEngine On RewriteCond %{REQUEST_URI} !\.[a-zA-Z0-9]{2,4} RewriteCond %{REQUEST_URI} !/$ RewriteRule ^(.*)$ $1.html

If that doesn’t work, try this:

RewriteCond %{REQUEST_URI} !^..html$ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.)$ $1.html [L,R=301]

Source: http://stackoverflow.com/questions/5745490/rewrite-rule-to-add-html-extension