/
Pack Hosting Panel

Configuring https & www redirects

How to configure https and www redirects at Hipex?


Nowadays we can readily assume every serious webshop uses an SSL certificate. To improve on your SEO value, we recommend to force all your webshop traffic from http:// to https://.

These SEO redirects are configured using Nginx, in this article we explain how to do this. We assume you are familiar with the here described location and folder structure of the Nginx configurations. Remember that after adjusting the Nginx configuration to reload it using the nginx-reload command.

Redirect from HTTP to HTTPS

All traffic that enters your website through HTTP is "stored" in the port-80 folder. This traffic is forwarded from this folder to HTTPS with a simple configuration.

To do this, create a new Nginx configuration file in this folder: /home/<username>/domains/<domain>/var/etc/port-80/.

To actually forward the traffic place the following configuration:

return 301 https://$host$request_uri;

Redirect to www

Next to this it is useful to redirect all traffic to www.mywebshop.com. To accomplish this add a Nginx configuration to the map /home/<username>/domains/<domain>/var/etc/.

In this configuration file the following configuration should be added:

if ($host !~* ^www\.) {
    return 301 https://www.$host$request_uri; 
}



Redirect to non-www

It can be desired to redirect all of the traffic to non-wwww. To accomplish this add a Nginx configuration to the map /home/<username>/domains/<domain>/var/etc/.

In this configuration file the following configuration should be added:

if ($host ~* ^www\.(.*)) {
    set $host_without_www $1;
rewrite ^(.*) http://$host_without_www$1 permanent;
}