I need help creating a rewrite rule/301 redirect for the following link structures in the .httaccess folder.
Source URL: www.example.com/sub_directory/product_name_1.html
Destination URL: www.example.com/prodcut-name-1.html
The requirements for the redirect then are as follows:
You can use these rules on top of your site root .htaccess:
RewriteEngine On RewriteRule ^(sub_directory/[^_]*)_+(.*)$ $1-$2 [NC,N,DPI] RewriteRule ^sub_directory/(.*)$ /$1 [R=301,NC,NE,L] # rest of your rules go here