301 Redirect Any Segment to First Segment
-
18-06-2021 - |
Question
Im trying to redirect pages such as:
/selected-work/project-name-1
/selected-work/project-name-2
/selected-work/project-name-3
/selected-work/category/category-name
to just
/work/
Is there a 301 redirect I can use that will notice it has a segment AFTER the first, and redirect ALL?
Using .htaccess
La solution
I managed to sort this by doing:
RedirectMatch 301 ^/selected-work(.*)$ http://www.website.co.uk/work
Which now redirects any sub-folders after /selected-work/ to /work/
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow