You can redirect HTTP traffic to HTTPS in Apache by following these steps:
1. Ensure that Apache mod\_rewrite is enabled.
You can enable it by using the following command (in Unix-based systems):```
sudo a2enmod rewrite
```
1. Use the mod\_rewrite to redirect from HTTP to HTTPS.
Open your Apache configuration file in a text editor (the location of this file, often named `httpd.conf`, can vary depending on how Apache was compiled and installed).```
sudo nano /etc/apache2/sites-enabled/000-default.conf
```
```
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
```
1. Save your changes and exit the text editor.
1. Ensure your configuration syntax is correct with following command:
```
sudo apachectl -t
```
1. If the syntax is correct, restart Apache to apply the changes:
```
sudo systemctl restart apache2
```
Please note that these steps assume that you have already set up SSL for your website.