I'm changing my domain www.old.com to www.new.com, for that m using 301 redirects via .htaccess
, and it's working fine, but the issue is I don't want to redirect my specific pages.
for example www.old.com/my-account or www.old.com/checkout. Can someone help me out?
RewriteEngine on
RewriteRule (.*) https://www.new.com/$1 [R=301,L]
Two obvious options:
You could add conditions to your existing rule:
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/my-account/?$
RewriteCond %{REQUEST_URI} !^/checkout/?$
RewriteRule ^ https://new.example.com%{REQUEST_URI} [R=301,L]
Or you could add exceptions that get applied before the general redirection:
RewriteEngine on
RewriteRule ^/?my-account/?$ - [L]
RewriteRule ^/?checkout/?$ - [L]
RewriteRule ^ https://new.example.com%{REQUEST_URI} [R=301,L]
Both alternatives can be implemented in the http server's host configuration, or, if you have no access to that, in an distributed configuration file (".htaccess").