Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question
    
Do you want to exclude one folder? Or all folders? If it's all folders, this should work: RedirectMatch 301 ^/([^/]+)\.html$ example.com/$1 –  Joost de Valk Sep 28 '11 at 13:43
    
no I want to exclude 1 folder (and its sub folders). Thanks for your help (and plugins!) –  Matthew Xerri Sep 28 '11 at 13:45

1 Answer 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]
share|improve this answer
    
Thanks Joost it worked! I will still try to implement the same rule for wordpress.org/extend/plugins/redirection . Tried a lot but so far only you solution worked. Note that I changed the last line to RewriteRule (.*)\.html example.com/$1 [R=301,L] and that I added the rule just after RewriteBase / –  Matthew Xerri Sep 28 '11 at 14:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.