Need help with htaccess rewrite



Hello fellow DreamHosters,

I have a blog that I’m writing:

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.


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

Or worst case:`

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

Thank you!


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]