I am removing a significant portion of my site that is outdated, irrelevant, taking up space, not generating traffic and overall, a waste of html…
That being said, all these pages are actual, static html pages (not dynamic). I would like to remove them and have any requests redirected (301) to the home page (if for some crazy reason someone actually finds one of these links somewhere).
Luckily, all these files are located in a sub directory which might make it easy to have 1 rule instead of hundreds. However, I am having a hard time actually getting this rule to work.
.htaccess File:
RewriteEngine On
redirect 301 /directory/([^/\.]+) http://www.example.com/
The urls to remove all start with http://www.example.com/directory/. What am I missing or messing up?
Thanks in advance for your help!!!
Try this one :