Let's say I have these two domains:

  • example.com.uy
  • example.uy

My goal is to set a proper domain's forward according to SEO best practices using a 301 Redirect, in order to enforce my users to be always browsing my site at www.example.com.uy, even when they come from example.uy and keeping the rest of the URL just like /cat/item/1?qwe=rty.

I'm using CloudFlare with their free package, their Page Rules seems to be what I need but I can't figure out how to properly set the forwarding. Perhaps I need to configure something at my domain registrar panel as well.

An example of the kind of redirection I want to achieve is:

  • http://example.uy/cat/item/1?qwe=rty>http://www.example.com.uy/cat/item/1?qwe=rty

Sub domain example:


I have tried:

  • example.uy/*
  • Forwarding to: http://www.example.com.uy/$1
  • Forwarding type: 302 Temporary

Sadly this is without success, because my .uy domain has no settings yet, simply because I don't know if I should use the same data I've used previously for .com.uy.

So the actual state is: A, AAAA, CNAME Screenshot

  • Add all the domains and CNAME to correct destination. If you have not mx record, then use default MX record.
    – Goyllo
    Commented Mar 12, 2016 at 17:53

2 Answers 2


The way that I do is, add the two domains to cloudflare, redicted it normally to the hosting. On the hosting cpanel, add both domains, and set on cpanel that this site redirect permanent to your main site, so if any day has to change something, is only on the web provider end.


I don't think you can do that with page rules, or at least not on the free plan. You can use a htaccess/vhost server side rule though (you may or may not need to include RewriteEngine On depending on if it's on already in htaccess)

RewriteEngine On

RewriteCond %{HTTP_HOST} ^(www\.)?example\.uy$ [NC]
RewriteRule ^(.*)$ "https://www\.example\.com\.uy/$1" [R=301,L]

You can also do it script side, here is how in PHP:

header($_SERVER['SERVER_PROTOCOL'] . ' 301 Moved Permanently');
header('Location: https://' . str_replace(array('&', "\n", "\r"), array('&', '', ''), 'www.example.uy' . $_SERVER['REQUEST_URI']));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.