Match Strings in One folder and redirect to other folder with parts of query string htaccess

from

http://www.example.com/oldfolder/subfolder/tour-from-**X**-to-**Y**/

Read More

to

http://www.example.com/newfolder/ **X** / **Y** /

I could not figure out how to search for a string [‘tour-from-X-to-Y‘] and then redirect. Please help me. [.HTACCESS]

Related posts

Leave a Reply

1 comment

  1. Put this code in your DOCUMENT_ROOT/.htaccess file:

    RewriteEngine On
    
    RewriteRule ^oldfolder/subfolder/tour-from-([^-]+)-to-([^/]+)/?$ /newfolder/$1/$2/ [NC,L,R=302]