In the root directory there is a .htaccess file, in the directory next to it there are html files to which the rule should apply, but for some reason it does not work.
.htaccess code
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteRule ^redirect/files/moved.zip$ /redirect/media/moved.zip [L]
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{REQUEST_FILENAME}.html -f
#RewriteRule ^(.*)$ $1.html [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+).html?$ /$1 [R=301,L]
site-avalible config
<VirtualHost *:8080>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/lab2
ServerName lab2
SSLEngine on
SSLCertificateFile ssl/cert.pem
SSLCertificateKeyFile ssl/cert.key
<Directory /var/www/lab2>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
I changed the access rights to rewrite in the Apache configuration, which I also did in the configuration of the “lab2” site, but it did not work.
New contributor
Ulrich Zven is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.