Reputation: 2378
Could somebody explain the safest and fastest (performance wise) way to perform 34 redirects, with a mix of straight up domain swaps and also some permalink structure changes? The old site is static HTML and the new site is WP. So a few examples would be:
www.olddomain.com/index.html > www.newdomain.com
www.olddomain.com/about-us.html > www.newdomain.com/about
www.olddomain.com/oldcategory/page.html > www.newdomain.com/newcategory/page
www.olddomain.com/page2.html > www.newdomain.com/newcategory/page2
EDIT:
I should add that I did read a few articles before posting, this one seemed useful with options for plugins or using .htaccess...
https://www.wpbeginner.com/beginners-guide/beginners-guide-to-creating-redirects-in-wordpress/
...but it seemed to focus on Wp to Wp redirects, and I wasn't sure if there was a different procedure for doing static to WP redirects. I also read that the .htaccess method can be slow if there are a lot of redirects.
In any case I'll go ahead and try the first suggestion!
Upvotes: 0
Views: 215
Reputation: 5211
you can add the following lines to your .htaccess file located at the root of your old domain: More info
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^olddomain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.olddomain.com$
RewriteRule (.*)$ http://www.newdomain.com/$1 [R=301,L]
</IfModule>
To redirect a single page to a new location on the same domain, use the following syntax:
Redirect 301 /old/old.htm https://www.example.com/new.htm
Redirect 301 /index.html > www.newdomain.com
Redirect 301 /about-us.html > www.newdomain.com/about
Redirect 301 /oldcategory/page.html > www.newdomain.com/newcategory/page
Redirect 301 /page2.html > www.newdomain.com/newcategory/page2
Upvotes: 2
Reputation: 2444
.htaccess file would be fast and clean (put in the root of the HTML site).
Example:
Redirect 301 /old/file.html https://www.askapache.com/new/file/
See https://www.askapache.com/htaccess/#htaccess_Code_Snippets
Upvotes: 1