Secure https redirect with github pages and letsencrypt doesn't work - ssl

I have two domains: example.com and example.org.
HTTP://www.example.com redirects to HTTPS://www.example.org (as expected)
HTTP://example.com redirects to HTTPS://www.example.org (as expected)
HTTP://www.example.org redirects to HTTPS://www.example.org (as expected)
HTTP://example.org redirects to HTTPS://www.example.org (as expected)
HTTPS://example.org redirects to HTTPS://www.example.org (as expected)
However, using HTTPS doesn't work. I think this is because I haven't proven that I own example.com to my CA (letsencrypt through GitHub pages).
HTTPS://www.example.com should redirect to HTTPS://www.example.org
HTTPS://example.com should redirect to HTTPS://www.example.org
This question is related but it goes a little over my head and I'm not sure how to implement it on Github pages with Namecheap.

I solved this by migrating to netlify. I recommend.
I used the information here and here to create a _redirects file that looks like this:
https://example.com/* https://www.example.org/:splat 301!
https://www.example.com/* https://www.example.org/:splat 301!
http://example.com/* https://www.example.org/:splat 301!
http://www.example.com/* https://www.example.org/:splat 301!

Related

Should I create a redirect to my HTTPS website

I created a simple Vue web application that is hosted by Heroku on a custom domain. Heroku automatically provides SSL certificates and my website works as intended on:
`https://www.example.com``
The intended behaviour is as follows (if secure/feasible):
example.com -> https://www.example.com
http://example.com -> https://www.example.com
http://www.example.com -> https://www.example.com
however the current situation is:
example.com -> http//www.example.com
http://example.com -> site cannot be reached
http://www.example.com -> http://www.example.com
I read quite some articles online but I am not sure whether a redirect introduces potential security issues. Additionally there are a few limitations flagged by Heroku. My Webhost is https://www.domein-registreren.nl/ and allows redirects through their web interface.
EDIT: I used Cloudflare to fix the issue for me. However, I am wondering if there are other ways to accomplish this.

Namecheap domain won't redirect without "www"

I'm looking to connect my domain to a heroku app. So far, the tutorials I've read say we want Namecheap to have the following records for domain example.com:
CNAME Record www www.example.com.herokudns.com
URL Redirect # https://www.example.com
With this config, I can successfully get to my homepage using:
http://example.com/
http://www.example.com/
https://www.example.com/
But for some reason https://example.com/ won't connect and times out. Does anyone know if there's a way to get both https://example.com/ and https://www.example.com/ to redirect successfully?
You won't be able to do this with DNS provided redirects.
The reason is that at the point of redirect, ie your DNS provider they would need to:
Accept https/443 requests to their redirector
have a valid certificate for hacksofcharity.com
if they don't you'll either receive a timeout, or a certificate mismatch in your browser. When apex domains are involved with https then your only option is to be using a DNS provider that supports using CNAME - see https://devcenter.heroku.com/articles/custom-domains#add-a-custom-root-domain and perform any redirects within your application code base.

SSL Cloudflare - www to non-www

I am having the following issues with the Cloudflare Flexible SSL (Always use HTTPS, Automatic HTTPS rewrites activated)
Before activating the Cloudflare SSL the website in question nicely redirected from
http://www.example.com to http://example.com same goes for
www.example.com to example.com
After the Cloudflare SSL activation when I type in the I the following into the address bar:
example.com > https://example.com (green lock)
http://example.com > https://example.com (green lock)
www.example.com > https://example.com (css, js, certain images are not loading, gray lock with yellow triangle in address bar - mixed content)
http://www.example.com > https://www.example.com (css, js, certain images are not loading, gray lock with yellow triangle in address bar - mixed content)
Can someone let me know where to start to fix this issue?
Ok, the Cloudflare SSL mixed content issues has been resolved. I found a hard coded wrong base url in the html code

.htaccess only allow access to directory when coming through the right url

Case:
I have a website www.xyz.com/ with folder / abc
I have made a subdomain abc.xyz.com which points (on the webserver) to the /abc folder
I would like to make it impossible for people to access www.xyz.com/abc and be redirected to abc.xyz.com
tried
a normal 301 redirect results in people also being redirected when they go to abc.xyz.com (so error for too many redirects).
Thank you.
I got it after a few trials and errors:
Redirect 301 /abc/ https://abc.xyz.com

Drupal Domain Redirection

We have two domains: www.example.com and www.example.org. Both point to the same site. But, we'd like everything to point to .org. We are running Drupal on a LAMP server hosted by Media Temple.
We have now started to have problems because our .com SSL cert expired, so anybody who goes to the .com site routinely gets scary messages in Chrome, etc.
How can we make it so that if somebody goes to https://www.example.com in google, they get nicely directed to http://www.example.org?
You can do this multiple ways.
.htaccess
RewriteEngine On
Redirect 301 / https://www.exmaple.org
In a PHP file
header("HTTP/1.1 301 Moved Permanently");
header("Location: https://www.example.org");
header("Connection: close");
You can try this module :
https://www.drupal.org/project/domain_301_redirect
This is the domain that all other domains that point to this site will be 301 redirected to. This value should also include the scheme (http or https)
I Hope help you!