1

I am using cloudflare to manage my domain, and I wanted to add a subdomain. I tried to do this:enter image description here

But it gives me an error. How would I add a subdomain like blog.arunpattni.com that sends to arunpattni.com/blog ?

  • Do you mind if the URL redirects or do you want it masked? you won't be able to use Cloudflares free SSL if you want it to MASK. Mask = blog.example.com appears in the address bar, redirect = blog.example.com changes to example.com/blog – Simon Hayter May 1 '17 at 13:46
  • Yet another question from somebody who is confused between DNS CNAME and HTTP redirects. :( I feel like we get two of these a week. – Stephen Ostermiller May 31 '17 at 17:09
3

The error you are receiving is because CNAME's only support domain names and not URL paths. You can setup a redirect using your hosting account or Cloudflare Page Rules.

14 Step Cloudflare Process in redirecting traffic from subdomain to main domain using Page Rules:

  1. Login to Cloudflare
  2. Use the drop-down menu in the upper left of your screen and click your domain that you want the redirect to take place on.
  3. Click the DNS icon at the top of the screen.
  4. Select CNAME using the drop-down options
  5. Add the sub domain in NAME
  6. Add your domain name in Domain name
  7. Leave TTL as automatic and Cloudclare enabled, click Add Record button.
  8. Click Page Rules icon
  9. Click Create Page Rule button
  10. Add alexa.example.com/* in the URL match field
  11. Click + Add a Setting, find Forwarding URL and click it
  12. Select the status code 301 - Permanent Redirect
  13. Add the Enter destination URL as http://example.com/alexaSkillDemo
  14. Click Save and Deploy button.
  • Not sure what you mean with option 2. I'm hosting on github pages, so not really sure what to do – Arun P May 1 '17 at 13:41
  • I've updated the answer... just follow those 14 steps and your good to go. – Simon Hayter May 1 '17 at 13:42
  • Is there any way to do it without using a page rule, as I only have one left, and I was hoping to add other subdomains – Arun P May 1 '17 at 13:47
  • Okay so you want to use a GitHub Repository with your sub domain? – Simon Hayter May 1 '17 at 13:58
  • If yes... create another question called "CloudFlare DNS: How to setup a GitHub Repository to a custom domain or sub domain?" and I'll answer it. – Simon Hayter May 1 '17 at 14:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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