RewriteEngine on
RewriteRule ^(.*)$ http://www.NEWfoobar.com/$1 [R=301,L]
I have this line of code from https://stackoverflow.com/a/7578810, inside .htaccess
and it currently works by migrating www.OLDfoobar.com
to www.NEWfoobar.com
and all its sub-directory structure just fine (intended behavior, all good)
now, how do I add additional rule that captures www.OLDfoobar.com
to redirect to one specific page in www.NEWfoobar.com
? say for example `www.NEWfoobar.com/welcomeToNewDomain
The [L]
flag is what gets me. and btw, I'm not so sure about what the $1
is for. That can't be a regex flag for the RewriteRule
pattern, yes?
ACCEPTED ANSWER
RewriteEngine on
RewriteRule ^/?$ http://www.NEWfoobar.com/some/sub/directory [R=301,L]
RewriteRule ^(.*)$ http://www.NEWfoobar.com/$1 [R=301,L]