I'm changing the entire structure of my website and there's a ton of pages that show up in search engines that I would like to do 301 redirects for. I know how to do them for individual files in the .htaccess file, but I was wondering if anyone knew a trick to get the entire contents of a folder to redirect. For example, here is a normal 301 redirect: redirect 301 /old/old.htm http://www.you.com/new.htm I would like to do this redirect 301 /old/ http://www.you.com/new.htm I know that code is wrong, but is there a way to do it? Thanks!!
Yeah, replace the old index page with this code: <meta HTTP-EQUIV="REFRESH" content="0; url=http://www.your.com/new.htm"> And it will completely redirect to the new folder
Geoffrey, he wants any request to any file in that directory redirected, not just the index page, and he wants permanent redirects, not meta refreshes. Here is the code you need in your htaccess file: RewriteEngine on RewriteRule ^/old/.* /new.htm [R=301,L] Code (markup): Or: RedirectMatch 301 ^/old/.* http://www.you.com/new.htm Code (markup):