Quantcast
Channel: BulletProof Security Forum » All Posts
Viewing all articles
Browse latest Browse all 12461

Reply To: Rewrite or Redirect old website domain to new domain with new url structure

$
0
0

First off, to be technically correct what that code is doing is rewriting URL’s and then redirecting them with the the R flag in a RewriteRule.  Rewriting would need to occur in the WordPress Rewrite Loop Start code for that type of rewrite code.  A typical redirect such as RedirectMatch 301 could be added anywhere in an htaccess file.

This RedirectMatch code below will redirect all old posts on the old site under the product-category category to the new site’s product-category category and the product-name category (not sure what product-name is – a single post or another category?) and all posts from the old site will match/redirect to their exact matching post URI on the new site by using a backreference $1

Notes:  This RedirectMatch code would need to be in the old site’s htaccess file since you are redirecting from the old site to the new site. This code will only work correctly if the old post names / URI’s are identical. ie URI /product-1/ on old site is also /product-1/ on the new site.

RedirectMatch 301 ^/home/product-category/(.*)$ http://www.newdomain.co.uk/product-category/product-name/$1

Examples of what would be redirected using this code:

the-old-domain.co.uk/home/product-category/product-1/ would be redirected to http://www.newdomain.co.uk/product-category/product-name/product-1/
the-old-domain.co.uk/home/product-category/product-2/ would be redirected to http://www.newdomain.co.uk/product-category/product-name/product-2/

If the old site is an HTML site and these old posts are HTML files then you would need to use this code below to redirect the old HTML files to the new WordPress posts.

RedirectMatch 301 ^/home/product-category/(.*).html$ http://www.newdomain.co.uk/product-category/product-name/$1
  • This reply was modified 11 hours, 9 minutes ago by  AITpro Admin.
  • This reply was modified 11 hours, 6 minutes ago by  AITpro Admin.
  • This reply was modified 11 hours, 4 minutes ago by  AITpro Admin.
  • This reply was modified 10 hours, 41 minutes ago by  AITpro Admin.
  • This reply was modified 10 hours, 37 minutes ago by  AITpro Admin.
  • This reply was modified 10 hours, 37 minutes ago by  AITpro Admin.
  • This reply was modified 10 hours, 29 minutes ago by  AITpro Admin.
  • This reply was modified 10 hours, 28 minutes ago by  AITpro Admin.

Viewing all articles
Browse latest Browse all 12461

Trending Articles