Asked By: Anonymous
I am having an issue with a subdirectory that has many different paths, but on the new website we are no longer using that structure. The old website worked this way:
example.com/photos/photo-1
example.com/photos/photo-2
example.com/photos/photo-3
On our new site we are not using /photos, and my current redirect attempts have not worked
Redirect 301 /photos https://example.com/
ends up redirecting to
example.com/photo-1
example.com/photo-2
example.com/photo-3
Removing the photos subdirectory, but still attempting to access the subdirectory that follow it.
The desired result would be for any attempt to access example.com/photos or example.com/photos/* should redirect to homepage at example.com/
Any help would be appreciated.
Solution
Answered By: Anonymous
This should do it.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^photos/(.+) https://example.com/ [R=301,L]
</IfModule>