generalcb
generalcb

Reputation: 143

.htaccess 301 redirect example /old-page/?utm_source=twitter.com to /new-folder/new-page/?utm_source=twitter.com

Been hacking away at this for a while now. How would I redirect old pages and their folder structures to new pages and their folder structures with everything intact in the URL at the end? Something like:

RedirectMatch 301 /old-page/(.*) /new-folder/new-page/$1

Upvotes: 1

Views: 60

Answers (1)

peter bray
peter bray

Reputation: 1345

RewriteRule ^old-page/(.*) /new-folder/new-page/$1 [L,R]

L flag tells Apache that it's the last rule to be executed for any matches. R flag does the redirect with 302 as default; if you want a different redirect type, use [L,R=301] for example.

Upvotes: 1

Related Questions