Question

Potential Security Risk Ahead Error on non-www urls

My issue is when I open my website without WWW then it doesn’t redirect to https://www.admecindia.co.in, in result page doesn’t open up and shows ‘Security Error’ like this:

Warning: Potential Security Risk Ahead

Firefox detected a potential security threat and did not continue to admecindia.co.in. If you visit this site, attackers could try to steal information like your passwords, emails, or credit card details.

When i click on the Advanced Button given there, then it shows this.

Websites prove their identity via certificates. Firefox does not trust this site because it uses a certificate that is not valid for admecindia.co.in. The certificate is only valid for www.admecindia.co.in.

Error code: SSL_ERROR_BAD_CERT_DOMAIN

my .htaccess code is:

<IfModule mod_rewrite.c>
 RewriteEngine On
  RewriteBase /

  RewriteCond %{HTTP_HOST} ^admecindia\.co\.in$ [NC]
  RewriteRule ^(.*)$ https://www.admecindia.co.in/$1 [L,R=301]
 

  RewriteRule ^index\.php$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /index.php [L]

</IfModule>

thanks


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
June 18, 2020
Accepted Answer

Hi there @ravibhadauria143,

It looks like that your Let’s Encrypt was issued only for the www version of your domain name.

I would recommend issuing a new SSL certificate which would include both the non-www and the www version.

To do that, I would recommend following the steps from this tutorial here:

https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-ubuntu-18-04

Basically, when you run the certbot command, you need to make sure that you specify the two versions:

  1. sudo certbot --apache -d your_domain -d www.your_domain

Hope that this helps! Regards, Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.