Regex to Remove File Extension

I am using the Redirection plugin and I would like to use it to redirect my old static html pages to the new WordPress pages. So basically anything that looks like http://www.example.com/page.html becomes http://www.example.com/page/

The only catch is that I want to exclude a folder so anything that is http://www.example.com/specialfolder/page.html shall remain untouched.

Related posts

Leave a Reply

1 comment

  1. Let’s see, this should do the trick then:

    RewriteCond %{REQUEST_URI} .html$
    RewriteCond %{REQUEST_URI} !^/specialfolder/
    RewriteRule (.*).html http://www.example.com$1 [R=301,L]