How Change Content-Language on Subdomain in Cloudflare Worker - http-headers

I have a Cloudflare Worker that I created and active, but I want to add content language in cloudflare worker and change language in one subdomain, while the other subdomain has the same language as main domain.
For example, I have domain Cilacap.info and any subdomain, content-language: id, but in en.cilacap.info and full url of en cilacap.info, content-language: en.
How can it be like this.
please help, thank you.

Related

How can I redirect a domain to another domain that includes a path (using DNS)?

I have two domains with GoDaddy: foo.com and bar.com
I want to redirect foo.com to bar.com/foo
I tried setting up Domain Forwarding from within the GoDaddy Dashboard and it did work, but not for HTTPS (which is the URL indexed within Google).
I checked with GoDaddy Support and received this response:
That will not work because your domain does not have an SSL Certificate active and there is no way to activate an SSL Certificate on it with a forward.
Maybe I'm overthinking this, but here's an alternative approach I had in mind:
Set the A record of foo.com to the same IP address that bar.com is using
Within the website code of bar.com, check the $_SERVER['SERVER_NAME'] and redirect appropriately
By using plain DNS this is not possible, the reason for this is that DNS is a protocol different than HTTP.
Some providers offer "forwarding" options but behind the scenes, they point your domain to an HTTP server the one later does the redirect.
For example, using CloudFlare this could be very easy to achieve, you need to setup up only one domain, let's say foo.com and then just create a page rule to redirect traffic to bar.com/foo, the rule could be something like:
*foo.com*
More info about the page rules can be found here: https://support.cloudflare.com/hc/en-us/articles/200168306-Is-there-a-tutorial-for-Page-Rules-

Cloudflare and cPanel issue - Reidrects back to main hostname

So I setup a subdomain off my regular domain. I then make an A record on Cloudflare to point to the IP address of my server. However, whenever I go to the subdomain, it just takes me back to the main hostname. (So i have sub.domain.com and when I go to sub.domain.com in my browser, it redirects me back to domain.com)
What could be the issue? I've checked .htaccess.
I've had similar issues with cPanel and Cloudflare before where cloudflare won't properly direct to the proper subdomain.
This is very difficult to look at without knowing the actual domain or subdomain in question. We don't do anything that would put a redirect in by default, so it sounds like it may be an issue on your server directly.

Redirecting a url to an existing server

I have recently purchased a domain mydomainname.ca for my web mydomainname.com i would like the .ca to redirect to .com. I am very new to setting up web domains and such since my website was previously set up by another person.
There are multiple possibilities and as long as you don't specify the exact deployment, I'll explain all (hopefully) of them:
if you have only a domain and possibly a dns, route the .ca domain to your webserver, where mydomainname.com is located and then add virtual host alias to your .com webserver configuration
if you have domain and webhosting and the previous option is not possible (i.e. you don't have access to httpd config), use HTTP meta-redirect tag or Location: header to redirect to your .com domain
References:
Apache2 conf: http://httpd.apache.org/docs/2.2/vhosts/name-based.html
HTML Meta tag: http://en.wikipedia.org/wiki/Meta_refresh
PHP header function: http://php.net/manual/en/function.header.php

Hiding a subdomain

I have a website on a subdomain, and would like to hide the fact that it's a sub-domain. How can I do so?
For example, the site is www.example.com, and it's a sub-domain of www.mydomain.com. I don't want people to know that example.mydomain.com is the same as www.example.com. How do I hide this? With .htaccess? How?
Thanks!!
www.example.com is impossible to be a sub-domain of www.mydomain.com. I think you mean they point to the same IP address and, therefore, they point to the same website (or there are some kind of redirect).
A domain is simply, example.com or mydomain.com. Examples of sub-domains of these domains are: www.example.com, mobile.example.com, whatever.mydomain.com and they could, or not, point to the domain root.
I'll present you an example:
Google App Engine let's you chose a appspot.com subdomain, for instance, myapp.appspot.com. If you call this subdomain you access your website. But people usually want to use their own domain, or a subdomain, for instance, myapp.mydomain.com. Both subdomains will return the same content. If you'd wish to disable the appspot.com subdomain, you may follow this solution.
You could use the 'proxy|P' (force proxy) flag.
Read the manual http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html
Note: mod_proxy must be enabled in order to use this flag.

How to Redirect any subdomain request to main domain?

I'm trying to redirect all subdomain requests for domain.com to www.domain.com even when the subdomain does not exist, for example if we have:
abc.domain.com to www.domain.com
Where abc can be any requests. Furthermore, that subdomain abc may be exists or not. But whatever it is, I want to redirect it to main domain.
And less important request is. How it is possible to keep the input address at the address bar and redirect to main domain?
It will be best for me if it is done by .htaccess
I use apache server.
Thank you.
Since you haven't specified the environment you use, here are some general tips:
First, there is a difference between redirecting:
The user types sub.domain.com into the browser's address bar, but is redirected to domain.com -> domain.com is in the address bar, as the user is now on domain.com
...and rewriting an URL in the background:
The user types in sub.domain.com and stays at this address. The user sees sub.domain.com but in the background some other page (in your case, that one under domain.com) is loaded and shown.
(Quickly explained.)
If you are using Apache, take a look at 301 redirects and url rewriting.
In addition to what Piedone said (which is on the HTTP server side), you also need to configure the DNS to have a catch-all for all subdomains, directing them all to your HTTP server.
This implicitly means that all possible subdomains will exist automatically.