.htaccess rules to redirect certain pages and the catch all others

I’m redirecting a site from an old platform to another. It’s got 300-400 pages and all the pages have different names.

It’s learn.example.com (old platform) to courses.example.com (new platform)

So I’ve put in some 301s at the beginning of the .htaccess file of the most important pages, for example:

Redirect 301 /courses-overview/ http://courses.example.com/courses

But at the end I need a catch-all to redirect any other page not previously specified as a 301 like learn.example.com/whatever to courses.example.com to catch any of the other 300-400 pages that don’t exist in the .htaccess file now.

Is that possible?

I’ve tried


RedirectMatch ^/.*$ http://courses.robcubbon.com/

at the end of the .htaccess but it overrides the specific 301s :frowning:

On all your previous 301 rewrite rules try adding this to the end [R=301,L] - this performs a 301 redirect and also stops any later rewrite rules from affecting this URL.
e.g. RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]

It may not work but I seem to remember reading that somewhere.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.