0

I am using WordPress 5.3.

I changed the URL of my site from example.com to example2.com. I want all example.com URLs to redirect to example2.com. Here is an example:

example.com/blog redirect to example2.com/blog

Can I add a redirect rule in WordPress? Here is my .htaaccess file:

# BEGIN WordPress

<IfModule mod_headers.c>
Header set Connection keep-alive
</IfModule>


<IfModule mod_rewrite.c>
RewriteEngine on 
RewriteRule ^(.*)$ http://www.example2.com/$1 [R=301,L]
</IfModule>

# END WordPress
Joseph Anderson
  • 4,114
  • 4
  • 45
  • 99
  • You can do this by adding a rewrite rule to the .htaccess file. Check this answer- https://stackoverflow.com/questions/1945568/htaccess-redirect-all-pages-to-new-domain – gjzim Aug 13 '19 at 14:57
  • Thanks for the feedback. I saw several answers and I edited my answer. The issue persists. Is there a way to redirect sub directories? – Joseph Anderson Aug 13 '19 at 17:21

0 Answers0