: 301 redirect all child pages to parent directory using .htaccess I need to 301 redirect all child pages of a specific parent directory on my website. i.e. redirect www.example/com/parent/child
I need to 301 redirect all child pages of a specific parent directory on my website.
i.e. redirect example/com/parent/child and example.com/parent/another-child etc. to example.com/parent
Is this achievable using the .htaccess file?
More posts by @Sent6035632
1 Comments
Sorted by latest first Latest Oldest Best
Near the top of the .htaccess file in the root of your site, you can add the following:
RewriteEngine On
RewriteRule ^(parent/). / [R,L]
The is just a backreference to "parent/" (saves repetition).
Change R to R=301 if this is intended to be permanent. (But only after you have confirmed that it works.)
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.