Redirect Domain to Subdomain using Cloudflare - redirect

I'm using a marketing automation platform to build landing pages and those landing pages URLS are automatically published with a subdomain structure, like:
https://subdomain.example.com/mylandingpage
I want to redirect all www and non www visits to the main domain to this landing page that I created, in other words I wish the https://example.com and https://www.example.comto be redirected to https://subdomain.example.com/mylandingpage
Since I'm only using this platform and did not subscribe to any hosting, I'm trying to use Cloudflare to make all this redirects.
I saw a tutorial and this guy said that A entries in my DNS shouldn't be blank and recommended setting them to a reserved IP address, so I set both A entries to 192.0.2.0.
Ok, then I went to page rules and set a 301 redirect to *example.com to be redirected to https://subdomain.example.com/mylandingpage
I can see that when I visit my main domain it's redirected to the subdomain correctly, but the page doesn't load, and I get a too many redirections error. I believe that I made something wrong and it's redirecting everything to the subdomain, even the subdomain is redirecting to itself, even having a page path /mylandingpage after the hostname.
Did I make myself clear? Is there any other way to do what I want?

In Cloudflare page rules instead of *.example.com, please use exact domain match.
URL path we can use wildcard.
www.example.com/* - https://subdomain.example.com/mylandingpage
example.com/* - https://subdomain.example.com/mylandingpage

Related

Cloudflare page rules using wildcard redirect

I wanted to redirect all old blog URLs to the new ones.
www.mysite.com/blog/anything-here should redirect to www.mysite.com/anything-here.
Basically, all URLs that have "blog/" should be redirected to the new URL which is without the "blog/"
I have tried it on Cloudflare page rule by using
mysite.com/blog/* to mysite.com/$1
It is working fine but if you visit mysite.com/blog only it redirects to mysite.com which it shouldn't be happening.
How should i set my redirect pagerule?

Domain Forwarding for specific URLs

I have a domain with GoDaddy called "livingmiracles.org". For years I had this domain forwarding to my livingmiraclescenter.org Joomla website. Recently, I discovered that the way the livingmiracles.org domain now forwards to our livingmiraclescenter.org site has changed and has left me with broken links on almost all of the over 60 websites I manage.
This is what used to happen:
Any URL of the livingmiraclescenter.org website would be able to be displayed with the livingmiracles.org domain instead. For example, the following URLs were interchangeable:
livingmiraclescenter.org/david-hoffmeister.html and
livingmiracles.org/david-hoffmeister.html
livingmiraclescenter.org/contact.html and
livingmiracles.org/contact.html
livingmiraclescenter.org/spiri-tv.html and
livingmiracles.org/spiri-tv.html
Also, variations of the above without ".html" would work.
Now, none of this works anymore. For the "livingmiracles.org/" links above, now, either the livingmiraclescenter.org home page pulls up or I get a GoDaddy error page.
I called GoDaddy and they confirmed a change in the way they handle domain forwarding now.
Can anyone suggest a simple/smart way—perhaps a RewriteRule or something like that—that I can set up somewhere (where?) to handle those specific page redirects? Basically, I want all my livingmiraclescenter.org links to be interchangeable with livingmiracles.org links like I wrote above in those examples.
Thank you so much!
Jutta

How can I redirect a request to a subdomain to another subdomain on Route 53?

I have a GitHub Pages Jekyll blog at blog.Antrikshy.com. I have been meaning to move it to code.Antrikshy.com for a while now. I made the new address a CNAME for antrikshy.github.io on Amazon and wired everything correctly to make it work. Now my blog.Antrikshy.com URL is broken. How can I set it to redirect it to the new subdomain?
I'm new to this. Comment if you want any more information.
Preferably I'd like to do a 301 redirect and also retain the entire path, but that's not very important. I just want it to work, even if it means that users are redirected to the new home page.
You could accomplish this with s3 website redirect[1].
create a new s3 bucket with the name blog.antrikshy.com
enable s3 website
create an alias to blog.antrikshy.com bucket
enable redirects on your website
you can create redirects per page as well by creating a key for each page or redirect everything to your homepage
http://aws.amazon.com/about-aws/whats-new/2012/10/04/web-page-redirects-on-amazon-s3-hosted-websites/

Redirect from a naked domain to www strips query string params

I've got my domain set up on iwantmyname.com and hosted by Heroku. There's a CNAME record pointing to example.herokuapp.com and the naked http://example.com redirects to http://www.example.com. That was fine until I realized that the redirect from the naked to the www strips off any query string parameters like important referral information.
How can I set it up properly so I'm not losing this information? I don't care whether the naked domain actually redirects to the www or just displays the normal page (e.g. it's fine if http://example.com/somepath shows up in the url bar instead of redirecting to http://www.example.com/somepath like it does now).

Will re-direction from home page affect search engine crawling?

There is a new domain, let's say va.in.
Content is being prepared for the sub-domain a.va.in
The idea is that va.in/index could contain pointers to various sections sometime in future (e.g. b.va.in, c.va.in etc.). As of now, it does not make sense to have such a page as there is just one section i.e. a.va.in
If I decide to re-direct va.in to a.va.in for now, will the search engines follow the re-direct and index the site?
Is DNS the best place to do the re-direction?
Using "301 Moved Permanently" search engine will only index sub-domain a.va.in.
If that's ok, you can do this using web server's config.
For example in Apache:
<VirtualHost va.in www.va.in>
Redirect permanent / http://a.va.in/
</VirtualHost>
You can't really use DNS to do redirect, because in DNS you cannot assign CNAME to #.
See: Is Root domain CNAME to other domain allowed by DNS RFC?
There is question related to yours: 301 Redirect vs DNS change: Is it ever safe to kill a 301 redirect and update the DNS for a subdomain?
Yes, the search engines follow redirects, if you redirect with a HTTP header
header ('HTTP/1.1 301 Moved Permanently');
header ('Location: '.$location);
I don't know about DNS redirect, but I'd rather not use it..
You can read more about how to do a HTTP redirect here.
You can redirect in two ways.
Programaticlally as evilpenguin said
Using the webserver (Example iis)
But there is one thing common in both these options. The redirect must be permanent redirect if you want to inform search engines that va.in is permanently moved to a.va.in
If you dont specity permanent redirects, still crawlers will go to a.va.in but in this case they wont be notified that it is a permanet redirect.
If some one has bookmarked va.in and in the first case (permanent redirection) bookmarks will get updated. But in the second case book marks wont be updated.
Hope this helps.