Mobile app version of vmapp.org
Login or Join
Kristi941

: Redirection from non-www to www through HTTPS takes longer than HTTP I have enabled SSL for my site in the vhost file. I also have the redirection for the non-www to www over port 80: <VirtualHost

@Kristi941

Posted in: #Apache #Https #Redirects

I have enabled SSL for my site in the vhost file. I also have the redirection for the non-www to www over port 80:

<VirtualHost 62.210.85.6:80>
ServerName pretty-story.com
Redirect permanent / www.pretty-story.com/ </VirtualHost>


However it seems it takes a lot longer (about 2 seconds) to redirect from non-www to www over https.

So if I type pretty-story.com, it quickly resolves to www.pretty-story.com but if I type pretty-story.com it takes more than 2 seconds to resolve to www.pretty-story.com !

I tried to add the following :

<VirtualHost 62.210.85.6:443>
ServerName pretty-story.com
Redirect permanent / www.pretty-story.com/ </VirtualHost>


But then the website becomes inaccessible.

What should I do ?

Here's the results on pingdom (using Sweden because my CDN is only active in Europe):

www.pretty-story.com -> 874 ms
tools.pingdom.com/#!/8cyCy/https://www.pretty-story.com www.pretty-story.com -> 1.04s
tools.pingdom.com/#!/laUz9/http://www.pretty-story.com pretty-story.com -> 947 ms
tools.pingdom.com/#!/cohyrq/http://pretty-story.com https://pretty-story.com -> 2.51s !!!!!!!!!!!
tools.pingdom.com/#!/7s1PK/https://pretty-story.com

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Kristi941

1 Comments

Sorted by latest first Latest Oldest Best

 

@Angie530

The answer to this question is detailed here : askubuntu.com/questions/653923/force-https-and-www-with-virtual-host-apache2/653947#653947
The key thing was to have 3 VirtualHost :


one for the http to https redirection
one for the https non-www to www redirection, which includes all the SSL settings
one for the https www version, which contains all the SSL settings + anything else you want.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme