Mobile app version of vmapp.org
Login or Join
Yeniel560

: 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

@Yeniel560

Posted in: #Apache #HttpdConf #Https #Virtualhost

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>

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Yeniel560

2 Comments

Sorted by latest first Latest Oldest Best

 

@Cody1181609

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>

10% popularity Vote Up Vote Down


 

@Pierce454

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>

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme