I've searched around and haven't found this specific question asked.
I need to redirect all the 'subfolders' of a directory to the parent directory.
For example, the parent directory is
example.tld/directory and all subdirectories such as
example.tld/directory/subdirectory-1 and e
xample.tld/directory/subdirectory-2 etc all need to redirect to
For clarification, these aren't actual directories but Drupal sub-paths, but I believe it should work to do this via htaccess.
Just to make it crystal clear, the URLs
should all redirect to
The idea is to make these subdirectories inaccessible to anyone and be sure that the search engine crawlers do not index these subdirectories.
What would be the proper htaccess code to achieve this?