As mentioned in comments, there is nothing in the config you have posted that would cause this. There are no redirects at all in the config you posted. This is most probably a configuration error in your CMS (Prestashop).
The problem appears to be with the HTTP to HTTPS redirect that is removing the slash at the start of the URL-path (immediately after the hostname).
However, you may be able to "workaround" this issue by implementing an HTTP to HTTPS (and non-www to www) redirect in .htaccess
- which occurs before your CMS is able to do anything. So, your CMS does not need to redirect the request.
For example, assuming you have a reasonably standard server, where the SSL is managed by the application server (no SSL proxy like Cloudflare etc.) then you could do something like the following at the very top of the .htaccess
file, before the # ~~start~~
comment.
# Redirect non-www to www + HTTPS
RewriteCond %{HTTP_HOST} ^(example\.com) [NC]
RewriteRule ^ https://www.%1%{REQUEST_URI} [R=301,L]
# Redirect HTTP to HTTPS (remaining requests)
RewriteCond %{HTTPS} =off
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
NB: Test first with 302 (temporary) redirects to avoid potential caching issues.
UPDATE:
I tried to add the lines you wrote above but nothing is changed.
This would imply you have a malformed HTTP to HTTPS in the server config itself (that executes before .htaccess
)
<VirtualHost *:80>
ServerName www.example.com
Redirect permanent / https://www.example.com
</VirtualHost>
If this is your actual config, then you are missing the trailing slash on the target URL! This will result in the malformed (missing slash after the domain) redirect you are seeing.
It should be:
Redirect permanent / https://www.example.com/
You will need to make sure the browser cache is clear before testing, since the erroneous redirect will have been cached.