Firebase hosting multiple domains rewrites for specific robots.txt - firebase-hosting

I have my website setup correctly via Firebase hosting and have connected multiple domains to it:
https://domain1.com, https://domain2.com and https://domain3.com
For SEO, each domain should best have a robots.txt and a sitemap.xml reference in it.
User-agent: *
disallow:
sitemap: https://domain1 or domain2 or domain3/sitemap.xml
The sitemap url in the robots.txt should be a full URL (not relative) and I can only specify one. So I created on the root of my projects different domain1_robots.txt, domain2_robots.txt
I read Firebase documentation about rewrite rules and glob patterns:
https://firebase.google.com/docs/hosting/full-config#glob_pattern_matching
But these patterns do not seam to check on the host name?
So how to create a rewrite rules like this?:
https://domain1.com/robots.txt -> /domain1_robots.txt
https://domain2.com/robots.txt -> /domain2_robots.txt
https://domain3.com/robots.txt -> /domain3_robots.txt
So that I can correctly serve the right robots.txt for each domain?
This would be possible by using a cloud function and some js code, but I do not want to invoke a cloud function for each crawler... (costs)

Related

Cloudflare redirect domain

I'm trying to redirect domainA.com to domainB.com. Both domains are managed with Cloudflare. I've tried using Page Rules for domainA to redirect all requests to domainB.com. However, I've also read that domainA needs to have DNS records of some sort through Cloudflare but I'm not entirely sure how to configure these? This redirect is the only thing I'm using domainA for, there's no content hosted on it at all.
A combination of a mock CNAME record and a Page Rule will make it.
Go to your source domain's DNS settings page.
Create a CNAME record for the # (root domain). Point it to some subdomain, it doesn't have to exist as the page rule will kick in before the DNS record resolves.
Go to your source domain's Page Rules page.
Create a new page rule redirecting all requests to your domain as necessary (choose 301/302 - whichever makes sense in your case).
Give it some time and confirm https://source-domain.com redirects to https://target-domain.com.
Repeat steps 1 - 5 for the www subdomain if you want www.source-domain.com to redirect too (which is often the case).
Set a forwading page rule 301 Redirect
from
http://domainA.com/*
to http://domainB.com/$1
In 6 steps you have new domain.
In your control panel, select the domain
Click on page rules
In 'url match' set example: (domainA.com/*)
Setting is 'forwarding url' with 302 (test) or 302 (production)
And finnaly set the new url ex: (http://domainB.com)
Save and deploy
for full documentation see this:
https://support.cloudflare.com/hc/en-us/articles/200172286-Configuring-URL-forwarding-or-redirects-with-Cloudflare-Page-Rules

Can you set ads.txt to redirect to a file on another server?

I've hit a bit of a problem with creating an ads.txt file. I'm working with an advertiser, and they would like to host the ads.txt file so they can easily make changes to it.
Is it possible to set up a redirect in at
mysite.com/ads.txt
which points to something like
theirsite.com/mysite/ads.txt
If so, what would be the code to you in mysite.com/ads.txt to make the redirect work?
For those looking, I did eventually find a solution to this by editing the following line into the .htaccess (you'll need to alter the path for your own link):
RewriteRule ^ads\.txt$ "https\:\/\/theirsite\.com\/clients\/folder\/ads\.txt" [R=301,L]
Per IAB's ads.txt Specification 1.0.1 (September 2017), section 3.1 "ACCESS METHOD",
Only a single HTTP redirect to a destination outside the original
root domain is allowed to facilitate one-hop delegation of authority
to a third party's web server domain.
So you should be fine with a single redirection from mysite.com/ads.txt >> theirsite.com/mysite/ads.txt.
It is possible with restriction. You can use redirects, as many as you want within the scope of the original root domain, which is not the fact in your situation.
For a third party domain the restriction is that only a single redirect is allowed. You should check if this is the fact for your advertisers ads.txt url.
Another possible solution is:
Crawl the advertisers ads.txt and put it in your specific folder once or twice a day.
See the specification:
https://iabtechlab.com/wp-content/uploads/2017/09/IABOpenRTB_Ads.txt_Public_Spec_V1-0-1.pdf
If the server response indicates an HTTP/HTTPS redirect (301, 302, 307 status codes), the
advertising system should follow the redirect and consume the data as authoritative for the
source of the redirect, if and only if the redirect is within scope of the original root domain as
defined above. Multiple redirects are valid as long as each redirect location remains within the
original root domain. For example an HTTP to HTTPS redirect within the same root domain is
valid.
Only a single HTTP redirect to a destination outside the original root domain is allowed to
facilitate one-hop delegation of authority to a third party's web server domain. If the third party
location returns a redirect, then the advertising system should treat the response as an error. A
future version may address other delegation of authority to a third-party web server. Any other
redirect should be interpreted as an error and ignored.

How to fix "load unsafe scripts"?

so I'll start from the very beginning.
Basicly I purchased a template off themeforest and I manually edited the code in a markup editor to match my preferences.
As I was finished, I decided to host my website on github pages - I uploaded my code directory to a repository as you do.
Here's a link to my repository:
https://github.com/KristofferHari/kristofferhari.github.io
Here's a link to my current website URL:
https://kristofferhari.github.io/ (As you can see, everything's kinda buggy)
So I managed to contact the seller and this is what I was provided with:
The reason for that is because the resources are using a http connection and they can’t be loaded on https connection website. So
you have to upload all the resources (scripts/stylesheets) to github
in order to use them on github.
So I suppose that through my browser, I am trying to connect to my website through a https connection rather than an http. (Is this what is actually causing the problem, and what's the difference between a http connection and a https?)
Secondly, how would I upload all my resources (scripts/stylesheets) to github?
Thanks in advance!
There is a relatively simple solution: to use a protocol-relative URL format.
e.g. your error
Mixed Content: The page at 'https://kristofferhari.github.io/' was loaded over HTTPS, but requested an insecure stylesheet 'http://fonts.googleapis.com/css?family=Open+Sans:400,700,300,900'. This request has been blocked; the content must be served over HTTPS.
The problem is you are loading
http://fonts.googleapis.com/css?family=Open+Sans:400,700,300,900'
from
https://kristofferhari.github.io/
The page is secure (HTTPS), but it's loading insecure content (HTTP).
To fix it, you basically need to change the stylesheet to:
https://fonts.googleapis.com/css?family=Open+Sans:400,700,300,900'
But a more flexible solution is to use a protocol relative format:
//fonts.googleapis.com/css?family=Open+Sans:400,700,300,900'
which will then work on either http or https.
Apply this change to all included resources.

Google Authorized redirect URIs

Let's say my app's main domain is at https://www.example.com
App is going to have lots of instances, i.e.
https://www.example.com/client1
https://www.example.com/client2
https://www.example.com/client3
<..>
In order to have OAuth2 authentication against my app, I currently have redirect URIs as such:
https://www.example.com/client1/SignInGoogle
https://www.example.com/client2/SignInGoogle
Is there a way to add one Authorized redirect URI for all of these clients? i.e.
https://www.example.com/*
or
https://www.example/com/*/SignInGoogle
Or does this URI has to be the exact match?
If you look at the Google Developer console
Must have a protocol (HTTP / HTTPS)
Cannot contain a URL Fragment (#)
Cannot contain a relative path.
Cannot be a public IP address.
Examples of Relitve vs Absolute URIs
Relative URI Absolute URI
about.html http://WebReference.com/html/about.html
tutorial1/ http://WebReference.com/html/tutorial1/
tutorial1/2.html http://WebReference.com/html/tutorial1/2.html
/ http://WebReference.com/
//www.internet.com/ http://www.internet.com/
/experts/ http://WebReference.com/experts/
../ http://WebReference.com/
../experts/ http://WebReference.com/experts/
./about.html http://WebReference.com/html/about.html
What you want to do is something like a Relative URI. What you need to remember is that an Authentication server is nothing but a web service. If you cant access the redirect URI from a normal web browser the authentication server cant either.
So no you cant do that it has to match exactly.

301 redirect vs parking

I have several domain names registered, each a slight variant of each other.
E.g,
fastcar.com
fast-car.com
fastcar.co.uk
fast-car.co.uk
etc..
I don't wish to be penalized for duplicate content or spammy links by any of the major search engines.
Should I park them all directly on the main domain I wish to promote, 301 redirect them to the main domain or not use them at all?
If 301 redirects are the best option, would having two web hosting accounts be better than one?
Example:
Hosting account 1 has fastcar.com linked through the dns.
Hosting account 2 has fast-car.com, fastcar.co.uk, fast-car.co.uk linked through dns, and 301 redirects pointing to fastcar.com
Thanks
I'd 301 redirect and then specify your preferred URL:
http://googlewebmastercentral.blogspot.com/2009/02/specify-your-canonical.html