: Redirect Permanent and https I just set up HTTPS on my server, and I have an issue with redirect permanent. Example http://domain.com/index.html it redirect me to http://www.domain.comindex.html
I just set up HTTPS on my server, and I have an issue with redirect permanent.
Example domain.com/index.html it redirect me to www.domain.comindex.html
The / (tail ending slash) is missing and I can't figure out how to fix it.
It's work with www.domain.com/index.html
Here is my httpd.conf
<VirtualHost *:80>
ServerName domain.com
Redirect permanent / www.domain.com/ </VirtualHost>
<VirtualHost *:80>
ServerName domain.com Redirect permanent / www.domain.com/ </VirtualHost>
<VirtualHost *:443>
DocumentRoot /var/www/domain/
ServerName domain.com SSLEngine on
SSLCertificateFile ssl.crt
SSLCertificateKeyFile ssl.key
</VirtualHost>
More posts by @Yeniel560
2 Comments
Sorted by latest first Latest Oldest Best
I had that same issue, and don't know why it is failing either. I was able to work around it using this instead:
<VirtualHost *:80>
ServerName domain.com
ServerAlias *.domain.com
# Redirect 301 / www.domain.com RedirectMatch permanent /(.*) www.domain.com/ </VirtualHost>
Change to this and try it, notice only two VirtualHost
<VirtualHost *:80>
ServerName domain.com
ServerAlias *.domain.com
Redirect permanent / www.domain.com/ </VirtualHost>
<VirtualHost *:443>
DocumentRoot /var/www/domain/
ServerName domain.com SSLEngine on
SSLCertificateFile ssl.crt
SSLCertificateKeyFile ssl.key
</VirtualHost>
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.