: Redirect all pages within subdirectory to new page After redoing my webshop, I need to redirect every URL within a certain directoy to a new page. All URLs beginning ith example.com/shop/...
After redoing my webshop, I need to redirect every URL within a certain directoy to a new page.
All URLs beginning ith example.com/shop/... should be redirected to the page located at example.com/products/.
I'm using this wordpress plugin for redirections, but I don't know if it can handle it or I need to edit the htaccess file or something.
.htaccess:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteRule ^shop/ /products/ [R=302,L]
</IfModule>
# END WordPress
More posts by @Shanna517
1 Comments
Sorted by latest first Latest Oldest Best
That WordPress plugin should be able to handle this, but otherwise it's just a one-liner in .htaccess (which will also be more efficient):
RewriteRule ^shop/ /products/ [R=302,L]
The above directive should go after the RewriteEngine and RewriteBase directives but before any other WordPress stuff.
This redirects /shop/<anything> to /products/.
Change the 302 (temporary) redirect to 301 (permanent) when you are sure it's working OK. Temporary redirects are easier to test since they are not cached by the browser.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.