Web Browsers Don't Pick Up SSL Certificate - google-chrome

I am setting up a ssl certificate for a website
http://www.wegetitall.ca
I have checked it with many different ssl checkers and everything is ok but neither chrome nor internet explorer pick it up. There is no lock sign in chrome and it doesn't even say the certificate is not secure, it just doesn't see it at all.
The certificate was bought from godaddy and more information about it can be found here: https://www.sslshopper.com/ssl-checker.html#hostname=www.wegetitall.ca
What could be the reasons it doesn't show?

I can see SSL connection with your website.
When you connect to your website, make sure you type https:// .... NOT http://
if the connection is http, you can redirect to https.
Check this thread for redirecting (it's based on a server with PHP running. Find the correct one that's applicable to you).

SSL is installed well you just need to redirect to HTTPS
Put following code in your .htaccess file.
RewriteEngine on
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule (.*) https://www.wegetitall.ca%{REQUEST_URI} [R=301,L]

Related

Self Hosted Website www redirect to non www

I am self hosting a website on a Synology NAS. I have set up an SSL certificate, set up the DNS records on Google Domains. If I enter the website, andrewr.ca, into a browser it works fine. If I enter www.andrewr.ca it does not work and the SSL is not valid. I am trying to figure out how to fix this issue but get stuck every time. I have a .htaccess file that looks like this:
And my Google Domains account looks like this. [enter image description
My SSL cert looks like this:
Could someone please point me in the right direction here. I just want to be able to enter www.andrewr.ca and it works the exact same as if I enter andrewr.ca
I have tried changing the CNAME, changing the .htaccess and also adding a different SSL certificate but had no luck with anything I try so far.
This honestly probably has two separated answers out there for you to find, but I am posting this just because it's a solution we use currently in our setup to rewrite non https to https AND non www to www in one swoop. These are the rewrite directives in my production .htaccess
#SSL = 1
RewriteCond %{HTTP_HOST} !^example.com$ [NC]
RewriteRule ^/?(.*)$ https://example.com/$1 [R=301,L]
# Redirect www and http to https - non-www
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [R=301,L]
This is not for everyone and ONLY works if you have a single domain in your setup -- Which the top two lines of the htacces file there are put there to deal with multiple domains on the single files set to canonicalize the domain .. Once you have multiple domains in there .. You WILL NEED a separated SSL for each domain, AND the www for it to work .. But as for a SINGLE domain, this will forward to https - non www without the need for a secondary SSL on the www

Redirect http to https google cloud load balance

I have created https load balance and added ssl certificate. site working with https:// but its not working http:// and getting 404 error
Added Headername as X-Forwarded-Proto and avlue as https in load balace header request
Added in .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
is there any to redirect http to https to avoid 404 error?
At this time, there is no way to directly configure the GCP Load Balancer to redirect traffic from HTTP to HTTPS; however, there is a workaround to do this. Using Nginx, you can add the following string within the nginx configuration file:
if ($http_x_forwarded_proto = "http") {
return 301 https://$host$request_uri;
}
If you are using Apache, then you will have to do the following if you want to redirect the traffic using the .htaccess file:
Run either "sudo a2enmod rewrite" or "LoadModule rewrite_module modules/mod_rewrite.so" depending on the Linux OS you are running. This will enable
Edit or create the .htaccess file in the domain root directory with the following:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
You can find more details on the following link here.
There is also an internal request to have this feature added within GCP HTTP/HTTPS Load Balancers. I cannot provide an ETA on if/when it will be applied; however, you can follow the Public Issue Tracker (PIT) on the progress of the request.

Why doesn't Chrome recognize my progressive web app?

I made a progressive web app with a nodejs backend. When I deploy it on my server, chrome does not recognize the app as a PWA. All other browsers do (firefox, opera...). This means I don't get the "download" prompt or the full screen view of my app.
It was working perfectly when it was deployed on heroku. I bought hosting and now it doesn't work. The main difference is that the app now runs on port 8443 because port 433 is used by a webserver. I looked on google and found that chrome only recognizes PWAs if they run on port 433. I asked the helpdesk and they told me to use a .htaccess file. I have not worked with one before and it does not seem to fix my problem. It automatically redirects to port 8443 but Chrome still does not recognize it as a PWA. This is the .htaccess I use:
SetEnvIf Request_URI "^(.*)" PORT=8443
RewriteEngine On
RewriteBase /
# CORS
Header add Access-Control-Allow-Origin "*"
# HTTPS
RewriteCond %{HTTPS} !=on
RewriteCond %{ENV:HTTPS} !=on
RewriteRule ^(.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# PORT
RewriteCond %{SERVER_PORT} !^%{ENV:PORT}$
RewriteRule ^(.*) https://%{HTTP_HOST}:%{ENV:PORT}%{REQUEST_URI} [L,R=301]
# RPROXY
# RewriteRule ^(.*) http://localhost:${ENV:PORT}/$1 [P]
I was wondering if the problem really occurs because the app runs on 8443 or if there is something else I don't know.
thanks!
I haven't tested this, but maybe using vhost and reverse proxy, so you can still serve your app on port 433 but reverse proxy the requests to your node server running on a different port.

Redirect a webpage to some other webpage using .htaccess beased on User Agent

I'm making an Android app (can't publish it to Play Store because my parents won't let me pay the developer fee) and so, I want the users to be able to check for app updates from within the app.
I have thought of my own way for that because I wasn't able to implement the other ways I found on the internet.
Now, I have a version checking page: "https://app.brokenhearts.ml/check-update.html".
Also, there's an download update page: "https://app.brokenhearts.ml/updated.html".
I've set a custom User Agent to the app "Broken Hearts/1.0". That's working fine as of now, as when websites are loaded from the app they're displaying that custom user agent. I'll be updating the User Agent of the app with every version (for example, app version 2.0 will have the User Agent "Broken Hearts/2.0").
So, whenever a user will check for update, the app is going to load "https://app.brokenhearts.ml/check-update.html" in the webview (with the User Agent "Broken Hearts/1.0"). Now when that's the latest update, I won't have added any special .htaccess rules to redirect it and so, the app will normally load "https://app.brokenhearts.ml/check-update.html". But, suppose I release v2.0, the users still on v1.0, will still be having their user agents set to "Broken Hearts/1.0", and thus, when checking for the update, they shall be redirected to "https://app.brokenhearts.ml/updated.html".
So, basically, whenever I release an update to the app, I'll be updating its User Agent and changing the .htaccess to redirect the users from the old user agent to the "download update page". So, users from any other user agent should remain unaffected and should be able to load the "version checking page" normally.
All of this is going to be based on User Agent and .htaccess. I think it's possible, however, I'm just not able to make the correct .htaccess code.
EDIT: I tried to use this code, I kind of found from Apache docs and modified it as per my needs:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_USER_AGENT} "^(Broken Hearts/1\.0)$"
RewriteRule "^/check-version\.html" /updated.html [R=301,]
However, it gives HTTP error 500.
Well, I found a solution!
I created a folder called "update" and placed the .htaccess in it. Modified it as folows:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_USER_AGENT} "^(Broken Hearts/1\.0)$"
RewriteRule ^$ https://app.brokenhearts.ml/updated.html [R,L]
RewriteRule ^$ https://app.brokenhearts.ml/check-version.html [L]
And I pointed the update checker in the app to https://app.brokenhearts.ml/update/.
So, now, if the user agent matches my custom one, it's getting redirected correctly to updated and if it's the latest one, it's getting redirected to the check version as expected.
Now, whenever I'll publish an update, I'll have to modify the .htaccess when the new rule as follows:
Suoopse, I've posted v3.0 update and users are still using 1.0 and 2.0, then my new .htaccess will be:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_USER_AGENT} "^(Broken Hearts/1\.0)$"
RewriteRule ^$ https://app.brokenhearts.ml/updated.html [R,L]
RewriteCond %{HTTP_USER_AGENT} "^(Broken Hearts/2\.0)$"
RewriteRule ^$ https://app.brokenhearts.ml/updated.html [R,L]
RewriteRule ^$ https://app.brokenhearts.ml/check-version.html [L]
I have tried it and it works. Posted it just hoping some other day it might help someone else.

How to htaccess 301 redirect pages with a question mark in the url

I'm trying to redirect several pages that all have question marks in the URL.
I essentially want to redirect:
www.example.com/?attachment_id=456 to www.example.com
There's a ton of pages with differend id #s also.
I've tried a few things in htaccess with no luck..
Any ideas?
This is what I tried:
RewriteCond %{QUERY_STRING} ^attachment_id=[0-9]
RewriteRule ^/$ http://www.example.com/? [L,NC,R=301]
Why can't you do this? This code should redirect a URL like this www.example.com/?attachment_id=456
RewriteCond %{QUERY_STRING} ^attachment_id=[0-9]+
RewriteRule ^/?$ http://www.example.com/? [L,NC,R=301]
I made the / optional so that it can be used in Apache config or .htaccess. Also I kept the ? that you have in the redirect at the end of the RewriteRule to remove any query strings on redirect.
Your approach is next to perfect, just some minor corrections:
RewriteEngine on
RewriteCond %{QUERY_STRING} attachment_id=[0-9]+
RewriteRule ^/$ http://www.example.com/ [L,R=301]
The above is the version for the host configuration. note that you have to restart the http server after having made changes to the host configuration for them to get effective. To debug refer to the http servers error log file, especially at restart time.
If you have to rely on .htaccess style files, then the syntax for the rule itself must unfortunately be slightly different:
RewriteEngine on
RewriteCond %{QUERY_STRING} attachment_id=[0-9]+
RewriteRule ^$ http://www.example.com/ [L,R=301]
Such file has to be located in the main folder of the document root of the host. also the interpretation of such files must be enabled in the host configuration by means of the AllowOverride option.
In general you should always prefer the host configuration for such rules over .htaccess style files, but you need administrative access for that. .htaccess style files are notoriously error prone, hard to debug and really slow the server down.