Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save nullx5/6dccb55606d5a0a5584ccb69dc297fe7 to your computer and use it in GitHub Desktop.
Save nullx5/6dccb55606d5a0a5584ccb69dc297fe7 to your computer and use it in GitHub Desktop.

Redirigir automaticamente de HTTP a HTTPS en apache

sudo nvim 000-default.conf
ServerName localhost
Redirect permanent / https://localhost/


sudo nvim default-ssl.conf
sudo a2ensite default-ssl.conf


a2query -s

sudo systemctl restart apache2


curl -I http://localhost/

curl -IL -k http://localhost/

@nullx5
Copy link
Author

nullx5 commented Apr 29, 2025

Redirigir automaticamente de WWW a simple dominio en apache

sudo nvim default-ssl.conf

<VirtualHost *:443>
    ServerName www.tusitio.com
    Redirect permanent / https://tusitio.com/
    SSLEngine on
    SSLCertificateFile ...
    SSLCertificateKeyFile ...
</VirtualHost>

<VirtualHost *:443>
    ServerName tusitio.com
    DocumentRoot /var/www/html
    SSLEngine on
    SSLCertificateFile ...
    SSLCertificateKeyFile ...
</VirtualHost>

sudo a2ensite default-ssl.conf

@nullx5
Copy link
Author

nullx5 commented Apr 29, 2025

GitHub redirige de https://www.github.com a https://github.com/ 301 code

Facebook redirige de http://facebook.com/ a http://www.facebook.com/ 301 code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment