@orpha
To redirect HTTP to HTTPS in an Apache web server, you can use the Apache mod_rewrite module. Here's how you can do it:
1
|
sudo a2enmod rewrite |
1
|
sudo nano /etc/apache2/sites-available/your_website.conf |
1 2 3 4 |
<VirtualHost *:80> ServerName your_domain.com Redirect permanent / https://your_domain.com/ </VirtualHost> |
Replace "your_domain.com" with your actual domain name.
1
|
sudo systemctl restart apache2 |
Now, when someone tries to access your website using HTTP, Apache will automatically redirect them to the HTTPS version of your website.