1

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.

  • 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
2

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]
  • 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

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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