{"id":4905,"date":"2023-10-24T17:06:21","date_gmt":"2023-10-25T00:06:21","guid":{"rendered":"https:\/\/SUMMALAI.COM\/?p=4905"},"modified":"2023-10-24T17:06:23","modified_gmt":"2023-10-25T00:06:23","slug":"how-to-setup-301-redirects-url-forwarding-using-cloudflare-dns-and-page-rules","status":"publish","type":"post","link":"https:\/\/SUMMALAI.COM\/?p=4905","title":{"rendered":"How to Setup 301 Redirects (URL Forwarding) Using Cloudflare DNS and Page Rules"},"content":{"rendered":"\n<p>The process of setting up redirects using Cloudflare\u2019s DNS is pretty simple. You add your domain, point the CloudFlare DNS records (A record &amp; CNAME record) to Cloudflare\u2019s server, and then setup a URL forwarding rule. That\u2019s pretty much it.<\/p>\n\n\n\n<p>The first two steps of this walkthrough have nothing to do with the actual CloudFlare 301 setup. They are the things you need to do&nbsp;<em>before<\/em>&nbsp;any of this works. So, if you\u2019ve already added your domain to your CF account and pointed your domain registrar\u2019s nameservers to it \u2013 you can skip them.<a href=\"https:\/\/devinschumacher.com\/cloudflare-301-redirects-forwarding-url-page-rules\/#cloudflare-dns\" rel=\"noreferrer noopener\" target=\"_blank\"><\/a><\/p>\n\n\n\n<h5 class=\"wp-block-heading\">1. Add Domain to CloudFlare<\/h5>\n\n\n\n<p>At the dashboard (<a href=\"https:\/\/dash.cloudflare.com\/\" rel=\"noreferrer noopener\" target=\"_blank\">dash.cloudflare.com<\/a>) of your CloudFlare account click the \u201cAdd a site\u201d button, and enter your domain on the next screen.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/ps-attachments.s3.amazonaws.com\/6b1bb934-4854-481a-8956-68b32ff9d141\/qCMkEEnojoPKcStzmFtLYg.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/ps-attachments.s3.amazonaws.com\/6b1bb934-4854-481a-8956-68b32ff9d141\/qCMkEEnojoPKcStzmFtLYg.png\" alt=\"\"\/><\/a><\/figure>\n\n\n\n<p>Once you do that, you\u2019ll be presented with pricing options. Just choose the free one (bottom of screen) and move on.<\/p>\n\n\n\n<p>Cloudflare will scan for existing DNS records and bring them over.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/ps-attachments.s3.amazonaws.com\/4eb3563f-5047-413d-b032-1cb837843f36\/i0U5-31fuAEk45i4X3hIng.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/ps-attachments.s3.amazonaws.com\/4eb3563f-5047-413d-b032-1cb837843f36\/i0U5-31fuAEk45i4X3hIng.png\" alt=\"\"\/><\/a><\/figure>\n\n\n\n<p>Keep them or delete them \u2013 the choice is yours (and depends on what you\u2019re trying to do).<\/p>\n\n\n\n<p>Click continue, and you\u2019ll get your account\u2019s nameservers.<\/p>\n\n\n\n<p>You\u2019ll need to update your current domain\u2019s nameservers, which you can find at the domain registrar \u2013 aka the place where you login to see your domain, and probably where you purchased it.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">2. Update NameServers<\/h5>\n\n\n\n<p>I can\u2019t make a tutorial for updating nameservers at every web hosting company, because there\u2019s like a trillion of them.<\/p>\n\n\n\n<p>But you\u2019ll just need to go to your account &gt; select your domain &gt; choose \u2018edit nameservers\u2019 or something similar &gt; paste in the nameservers that Cloudflare gave you in the last step.<\/p>\n\n\n\n<p>Now, it will take anywhere from 10 minutes to 48 hours for those changes to take effect. This is called propagation.<\/p>\n\n\n\n<p>But you don\u2019t have to wait for that to continue. You will have to wait for it for all the things you do next to&nbsp;<em>work,&nbsp;<\/em>however.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">3. Update CloudFlare DNS<\/h5>\n\n\n\n<p>This is where the actual process starts.<\/p>\n\n\n\n<p>Go to your domain settings in CloudFlare and choose \u201cDNS\u201d.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/ps-attachments.s3.amazonaws.com\/c9069c59-2dc9-4534-a410-1f0001c46bbe\/kQxiHoNQq-04SKajrVJOwA.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/ps-attachments.s3.amazonaws.com\/c9069c59-2dc9-4534-a410-1f0001c46bbe\/kQxiHoNQq-04SKajrVJOwA.png\" alt=\"\"\/><\/a><\/figure>\n\n\n\n<p>If redirecting the whole domain I usually start with deleting the current DNS records that CloudFlare ported over. Don\u2019t do that if you have records in there you need.<\/p>\n\n\n\n<p>Yes, captain obvious I know but\u2026 Common sense isn\u2019t always so common in these extremely tense IT settings\u2026<\/p>\n\n\n\n<p>Next, we\u2019re going to add in the CloudFlare DNS records you need for your URL Forwarding to work.<\/p>\n\n\n\n<p>Click \u2018Add record\u2019 and add the following information, and click the \u2018Save\u2019 button:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Type<\/strong>: A<\/li><li><strong>Name<\/strong>: @<\/li><li><strong>IPv4 Address<\/strong>: 192.0.2.1<\/li><\/ul>\n\n\n\n<p>Now, click the \u2018Add record\u2019 button again, add the following information, and click the \u2018Save\u2019 button:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Type: CNAME<\/li><li><strong>Name<\/strong>: www<\/li><li><strong>Target<\/strong>: @<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/ps-attachments.s3.amazonaws.com\/b7ba67c7-cfad-40f5-8da9-f6887464c330\/sYLDDn5o5X7vwLTOCJ1Dfw.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/ps-attachments.s3.amazonaws.com\/b7ba67c7-cfad-40f5-8da9-f6887464c330\/sYLDDn5o5X7vwLTOCJ1Dfw.png\" alt=\"\"\/><\/a><\/figure>\n\n\n\n<h5 class=\"wp-block-heading\">4. Setup Page Rules for URL Forwarding<\/h5>\n\n\n\n<p>Navigate to the \u201cRules\u201d area on the sidebar, then click \u201cPage Rules\u201d and click the \u2018Create Page Rule` button.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/ps-attachments.s3.amazonaws.com\/b14cad7e-d071-485c-b28e-8272f5b8796f\/qNht1k-34EfonmqdWFpMXg.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/ps-attachments.s3.amazonaws.com\/b14cad7e-d071-485c-b28e-8272f5b8796f\/qNht1k-34EfonmqdWFpMXg.png\" alt=\"\"\/><\/a><\/figure>\n\n\n\n<p>Now it\u2019s time to set your 301s!<\/p>\n\n\n\n<p>I\u2019m going to setup a 301 redirect to forward all traffic coming to \u2018domain A\u2019 to \u2018domain B\u2019, but you can easily just change the URL &amp; destination to fit your needs.<\/p>\n\n\n\n<p><strong>Follow these steps:<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Enter the URL pattern you want 301ing<\/li><li>Click the dropdown and choose \u2018URL Forwarding\u2019<\/li><li>Select your \u2018Status Code\u2019 from the drop down (probably 301)<\/li><li>Enter the destination<\/li><li>Click \u2018Save and Deploy Page Rule\u2019<\/li><\/ol>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/ps-attachments.s3.amazonaws.com\/dc1d74d5-5c15-438f-b52a-e7fd7be9b84e\/v2cetpAhUbWRd8giQaxNIQ.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/ps-attachments.s3.amazonaws.com\/dc1d74d5-5c15-438f-b52a-e7fd7be9b84e\/v2cetpAhUbWRd8giQaxNIQ.png\" alt=\"\"\/><\/a><\/figure>\n\n\n\n<p>I entered the root domain, and put an asterisk ( * ) at the end, which means that if anyone goes to an inner url, like \u201cdomain.com\/whatever-asdfadf\u201d it will also get redirected.<\/p>\n\n\n\n<p>You can setup inner URL specific 301s too.<\/p>\n\n\n\n<p>Now, I\u2019m simply going to do the exact same thing again \u2013 but this time add the www. version.<\/p>\n\n\n\n<p><strong>Follow these steps:<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Enter the URL pattern you want 301ing<\/li><li>Click the dropdown and choose \u2018URL Forwarding\u2019<\/li><li>Select your \u2018Status Code\u2019 from the drop down (probably 301)<\/li><li>Enter the destination<\/li><li>Click \u2018Save and Deploy Page Rule\u2019<\/li><\/ol>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/ps-attachments.s3.amazonaws.com\/94a518d8-4493-4b3a-b8b4-4d2949951bec\/ht9cusjvFZNUCmIZiqtMCQ.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/ps-attachments.s3.amazonaws.com\/94a518d8-4493-4b3a-b8b4-4d2949951bec\/ht9cusjvFZNUCmIZiqtMCQ.png\" alt=\"\"\/><\/a><figcaption>Ref: https:\/\/www.process.st\/templates\/how-to-setup-a-cloudflare-dns-301-redirect-page-rules-url-forwarding\/<\/figcaption><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>The process of setting up redirects using Cloudflare\u2019s DNS is pretty simple. You add your domain, point the CloudFlare DNS records (A record &amp; CNAME record) to Cloudflare\u2019s server, and then setup a URL forwarding rule. That\u2019s pretty much it. The first two steps of this walkthrough have nothing to do with the actual CloudFlare <a class=\"read-more\" href=\"https:\/\/SUMMALAI.COM\/?p=4905\">Read More<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[238,1685],"tags":[1698,1699],"class_list":["post-4905","post","type-post","status-publish","format-standard","hentry","category-cloud","category-cloudflare","tag-setup-redirects-cloudflare","tag-url-forwarding-cloudflare"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/4905","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4905"}],"version-history":[{"count":1,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/4905\/revisions"}],"predecessor-version":[{"id":4906,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/4905\/revisions\/4906"}],"wp:attachment":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4905"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4905"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4905"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}