I removed an old directory from my website and now of course google is showing a bunch of 404 error pages that I would like to clean up. Basically, I have a bunch of dead links that are like this: http***mydomain.com/directory/detail/link-1.html http***mydomain.com/directory/detail/link-2.html http***mydomain.com/directory/detail/link-3.html and I would like to 301 redirect them to this: http***mydomain.com/directory/ I know this is a relatively easy redirect, but it has been so long since I messed with any .htaccess files I can't get it to work. Anyone know how to do this? Thanks for your help!
There's two ways to solve this out One is to use ErrorDocument 404 and redirect it to your main directory/domain. This way, any and all 404 errors will automatically redirect to your main domain/directory. The second, (.htaccess) should be something along these lines: RewriteEngine On RewriteRule ^directory/detail/(.*)$ directory/ [L] Code (markup): Code above assumes the subdirectory detail is now obsolete and no longer in use thus being redirected to the subdirectory directory
Awesome, thanks for the help starkman! I knew that there was a fairly simple fix for this, just couldn't figure it out on my own.