0

I have this rule in my htaccess file

Redirect 301 /directory/myfolder /myfolder

it obviously redirects all links with /directory/myfolder to /myfolder even I try to access /directory/myfolder/another_folder

I want to apply few exception like it should not redirect these links

/directory/myfolder/another_folder1

/directory/myfolder/another_folder2

/directory/myfolder/another_folder3

Thanks

  • `Redirect` does not allow any conditional logic. You will need to use mod_rewrite rules (`RewriteRule`). Take a look here: http://stackoverflow.com/questions/1848500/htaccess-mod-rewrite-how-to-exclude-directory-from-rewrite-rule – martynasma Aug 18 '15 at 04:44

1 Answers1

0

Use RedirectMatch

RedirectMatch 301 ^/dir/myfolder$ /myfolder
Amit Verma
  • 40,709
  • 21
  • 93
  • 115