: How to bulk redirect URLs and replace one path segment? I have several URLs in a WordPress website I would like to rewrite and then make a 301 redirect. URLs are of the form www.example.com/prodotto/something-after
I have several URLs in a WordPress website I would like to rewrite and then make a 301 redirect.
URLs are of the form
example.com/prodotto/something-after
These URLs should be changed to
example.com/shop/something-after
Should I use URL rewrite rules in .htaccess? I have used this rule, but it doesn't work:
# 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 ^/?prodotto/(.*)$ www.example.com/shop/ [R=301,L]
</IfModule>
# END WordPress'
More posts by @Steve110
1 Comments
Sorted by latest first Latest Oldest Best
You can use Apache Module mod_rewrite:
RewriteEngine ON
RewriteRule ^/?stringtochange/(.*)$ www.domainname.com/newstring/ [R=301,L]
The string after stringtochange is passed to the other url containing newstring in the variable.
So for example, if you access example.com/stringtochange/cool-page.html it will get redirected to example.com/newstring/cool-page.html.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.