Ir para conteúdo
View in the app

A better way to browse. Learn more.

Portal do Host

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Mini Tutorial - Como Forçar Seu Site A Abrir Sempre Em Https (Ssl)

Featured Replies

Postado

Olá pessoal meu 4° tópico de hoje! hehe'

Esse é pequeno é mini.

 

Para forçar seu Site a abrir sempre em https (SSL)
 
1ª) Alterando seu arquivo .htaccess
Esta á a alternativa que considero mais simples e prática. Basta apenas inserir este código em seu .htaccess:
    
    RewriteCond %{HTTPS} !=on
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
 
::::::::::::::::::::::::::::::::::::::::::::::::::::::
 
2ª) Através do PHP
Para aqueles que, por algum motivo, não podem alterar o .htaccess, há esta function que resolve o problema.
 
<?php
function ForceHTTPS() {
    if ($_SERVER[‘HTTPS’] != "on") {
        $url = $_SERVER[‘SERVER_NAME’];
        $new_url = "https://" . $url . $_SERVER[‘REQUEST_URI’];
        header("Location: $new_url");
        exit;
    }
}
?>

 


Postado

 

Olá pessoal meu 4° tópico de hoje! hehe'

Esse é pequeno é mini.

 

Para forçar seu Site a abrir sempre em https (SSL)
 
1ª) Alterando seu arquivo .htaccess
Esta á a alternativa que considero mais simples e prática. Basta apenas inserir este código em seu .htaccess:
    
    RewriteCond %{HTTPS} !=on
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
 
::::::::::::::::::::::::::::::::::::::::::::::::::::::
 
2ª) Através do PHP
Para aqueles que, por algum motivo, não podem alterar o .htaccess, há esta function que resolve o problema.
 
<?php
function ForceHTTPS() {
    if ($_SERVER[‘HTTPS’] != "on") {
        $url = $_SERVER[‘SERVER_NAME’];
        $new_url = "https://" . $url . $_SERVER[‘REQUEST_URI’];
        header("Location: $new_url");
        exit;
    }
}
?>

 

 

Ao colar um código no fórum revise pois dessa forma não irá funcionar http://clip2net.com/s/6LsWg5

 

Uma forma mais prática seria:

if( !isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == '' ) {
    $redirect = "https://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    header("Location: $redirect");
}

Postado
  • Autor

E que eu não achei nenhuma linguagem que se adaptasse, mais obrigado edvan, você acaba de ganhar mais um like.



Visitante
Este tópico está impedido de receber novos posts.

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Informação Importante

Concorda com os nossos termos?

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.