Question

I need to set up a subdomain to redirect to a specific URL, not another domain. I'm using cloudflare.

I tried to do this by creating an A record pointing to the IP of the server and then I created a Page Rule which redirects from my subdomain to a specific address.

Can anyone help me with this? I'm totally lost, I find information on this anywhere.

thanks

Was it helpful?

Solution

Maybe it will be easier to make redirection with rewrite rules through .htaccess or virtual host configuration?

  • At Cloudflare CP: create A record for subdomain in DNS section (if you don't have * A record already)
  • At webserver: configure virtual host or/and add rewrite rules to redirect to needed URL

OTHER TIPS

There is a fairly extensive tutorial about PageRules in our knowledge base & on our blog.

Note: You do need to make sure the DNS record is proxied in your DNS settings for it to work. Redirects won't work if the record is going direct to your server.

I suspect there's a bug on cloudflare ( I already reported it ) If you have your subdomain record in place along with orange cloud proxy active and the correct url pattern and forwarding address set and it still refuses to work, then you are experiencing the -still to be confirmed- bug.

This quick fix did the trick for me:

  1. Go to cloudflare settings.
    domain settings contextual menu on cloudflare
  2. Change the "CDN only" performance setting to "CDN + basic optimizations".
    contextual menu for performance settings and mouse indicating selection

It will start working immediately, after that you can go back to "CDN only" and it will continue to work.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top