skip to Main Content

Hy,

I want to redirect http request to https only when ssl is not expired and if ssl expired then keep request in http.

How can I do this?

I have api in my laravel project.

Need anymore information let me know.

2

Answers


  1. RewriteEngine On
    

    Add below code in your .htaccess file after rewrite engine on

    RewriteCond %{HTTPS}  != on 
    RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L] 
    
    Login or Signup to reply.
  2. You can use a cron job to auto renew the certification (in case of Let’s encrypt )

    Forget to use complex rule to verify the validaty of SSL certification

    they are a lot of article , about configure redirection from Http tp Https

    https://linuxize.com/post/redirect-http-to-https-in-apache/

    https://www.tecmint.com/redirect-http-to-https-on-apache/

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search