...

HTTPS forwarding - How to set up a secure connection

Secure HTTPS redirection ensures that all website visitors are automatically redirected to the encrypted version of your site - regardless of which URL they enter. In addition to protecting sensitive data, this also improves your visibility in search engines and noticeably increases the trust of new users.

Key points

  • SSL Certificate is a prerequisite for any HTTPS redirection
  • 301 forwarding Ensures SEO ranking and user guidance
  • .htaccess or nginx are common methods of conversion
  • HSTS header supplements security in the long term
  • WordPress plugins like Really Simple SSL make configuration easy

Why HTTPS forwarding is essential

HTTP transmits content in plain text - a risk for personal data and sensitive information. HTTPS forwarding ensures that all requests are automatically encrypted, even if users are still using an old bookmark with "http://". Browsers such as Chrome or Firefox actively warn of unencrypted pages. Google, on the other hand, rewards secure pages with a better ranking. The changeover not only improves technical security, but also the impression of your brand.

Imagine someone accesses your site directly with "http://" - without redirection, the visitor ends up on a potentially insecure version. This is exactly why the right HTTPS redirect is so important.

In addition, the enforced SSL connection ensures a professional appearance of your website. In times when data protection and IT security are becoming increasingly important, even a brief moment of mistrust on the part of the user can be enough to lose them permanently. Protecting login data, order information and confidential requests is vital for online stores and service providers. With the help of HTTPS forwarding, you can ensure that all communication is protected throughout. In conjunction with additional security measures (e.g. regular backups and up-to-date software versions), you can build a robust foundation to guarantee your visitors a secure experience.

It is also worth updating internal links or resources to the HTTPS version to avoid so-called mixed content warnings. These warnings occur when parts of the website are loaded via HTTP even though the website itself is accessible via HTTPS. This can lead to browser warnings and affect the trust of your users. Therefore, make sure that external scripts, images or stylesheets are also only integrated via HTTPS.

What requirements do you need to fulfill?

At the beginning you need a valid SSL Certificatewithout which no encrypted connection is possible. With many hosting providers such as webhoster.de a Let's Encrypt certificate is already included in the basic package. Alternatively, certificates with extended trust protection are available for a fee. As soon as your SSL certificate is active, you can technically implement HTTPS forwarding - for example via .htaccess or server configuration. Make sure that the certificate is automatically renewed on an ongoing basis to avoid error messages in the browser.

Important to know: Some offers include wildcard certificates that cover several subdomains at the same time. If you have different subdomains (e.g. store.your-domain.com, blog.your-domain.com), a single wildcard certificate is often the better choice. This reduces complexity as you don't have to install a separate certificate for each subdomain and ideally also prevents forgotten renewals. Please also note that a separate certificate is required for each independent domain, unless you use multidomain certificates.

Also take the opportunity to check your website for possible vulnerabilities before or during the changeover. An outdated content management system or old plugins increase the risk of security vulnerabilities. HTTPS redirection alone is not enough: you should always keep your system up to date and close potential vulnerabilities before attackers have the opportunity to exploit them.

How to set up the .htaccess redirect

The .htaccess file is your tool for redirecting all requests directly to HTTPS - ideal for Apache servers. Add the following code to the root directory of your website:

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

These lines check whether the connection is already encrypted. If not, you are immediately redirected to the HTTPS version. Important: Position the code at the top of the file so that no other rules interfere. Test the redirection immediately after the entry in a new private window.

For complex web projects, make sure that existing rewrite rules are compatible with your new HTTPS redirect. If you have already set up individual redirects (e.g. from old URLs), it is advisable to check carefully whether these still work as desired. Minor adjustments are often necessary to ensure a smooth process.

If you receive the error message "Too many redirects", this may mean that your redirects are caught in a loop. Then check whether there may already be a redirect in another .htaccess file or server configuration. In such cases, a single redirect snippet that works globally is often sufficient instead of using several methods in parallel.

HTTPS forwarding via nginx or hosting panel

If your web server is set to nginx the forwarding takes place directly in the server configuration. The line of code required for this is simple but effective:

server {
    listen 80;
    server_name your-domain.com;
    return 301 https://$host$request_uri;
}

Many web hosters like webhoster.de enable HTTPS forwarding with a click in the user area. Here you will usually find a checkbox labeled "Force HTTPS" or "Enable secure forwarding". Use this function if you do not want to work in the system or want additional security mechanisms.

The advantage of an integrated hosting solution is obvious: the hosting panel usually synchronizes all certificates, cron jobs for renewal and server settings. This saves you time-consuming searches for configuration commands. Every change can be made conveniently via a graphical interface, which is ideal for beginners or admins with a focus on efficiency.

Please note, however, that if you move to another provider, you may have to make the settings again. Make a note of these settings and ensure that you can fall back on a manual procedure (e.g. via .htaccess) in the event of an error. In the event of serious server failures or updates, it can also be more helpful to check the configuration yourself instead of relying solely on the hosting interface.

PHP variant of HTTPS redirection

You have no way to change the server settings? A PHP-based solution is the last resort. Insert this code directly at the beginning of your index.php:

if ($_SERVER['HTTPS'] != 'on') {
    header('Location: https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
    exit();
}

This redirection works reliably, but requires the file to be loaded with every call. It generates more server load and is considered less performant. Only use this approach if .htaccess or server access are not an option.

Also bear in mind that you will have to adapt the index.php - if you have several entry files or use a framework, the code may not work everywhere. The same applies here: test your setup thoroughly in different browsers and scenarios. To save traffic and optimize access times, most experts still recommend server-side redirection whenever it is available. If you need a temporary solution to ensure security quickly, this approach can work perfectly well.

WordPress: HTTPS conversion made easy

You can easily activate HTTPS in WordPress. Once your SSL certificate is active, go to the settings and replace the website URL with the version that starts with https:// begins. Alternatively, you can install the "Really Simple SSL" plugin. It not only handles the redirection, but also adjusts internal links and media URLs. Once activated, it ensures that visitors are automatically redirected to the secure version - without any additional intervention.

The combination of plugin and server forwarding offers optimum redundancy and reduces sources of error in the header or with embedded content. Make sure to also activate the options in the plugin settings that recognize or bypass mixed content. This ensures that no outdated paths via HTTP impair the user experience. For an existing WordPress website with many posts and images, it can be useful to use a plugin such as Better Search Replace to quickly and automatically convert old http links to https.

Another aspect of WordPress is the issue of theme compatibility. Some themes load scripts from external sources or use integrations that still refer to HTTP. Therefore, after the conversion, check whether your theme or child theme is also fully set to HTTPS. This will help you avoid warning messages in the browser and demonstrate a consistently secure website to your visitors.

Activate HSTS: Even more security

With HTTP Strict Transport Security (HSTS), you tell the browser that in future HTTPS only may be used. This prevents man-in-the-middle attacks or inadvertent calls to insecure connections. You activate HSTS via this header:

Strict-Transport-Security: max-age=31536000; includeSubDomains; preload

Important: Test everything thoroughly before you take this step. An incorrectly set HSTS header can paralyze your domain for a year when the SSL certificate expires or is renewed. You should only use HSTS as soon as a correct redirect to HTTPS is fully effective and no more content is accessible via HTTP.

The "preload" parameter in particular is sensitive, as you can enter your domain in a list that is used by all common browsers to only allow HTTPS connections. Once entered, you cannot usually simply change it back - the domain remains set to HTTPS. Although this gives you maximum security, you should make sure that your certificate management works perfectly to prevent shutdowns or negative effects.

For most small to medium-sized projects, HSTS is definitely recommended, as long as you have dealt with the potential pitfalls. Users who have already accessed your site once via HTTPS cannot fall back to HTTP the next time. This massively reduces potential security vulnerabilities.

Typical errors and their solution

Many websites lose the trust of their visitors due to small errors. Often the SSL Certificate or the .htaccess is incorrectly integrated. Caching plugins such as WP Super Cache or Autoptimize also cause outdated redirects - in this case, you need to clear the cache manually. Use Google Chrome and open the "Network" tab via Developer Tools to check redirects step by step. The SSL Labs tool will also help you to validate your setup and identify risks.

Another common stumbling block is the incomplete change of internal links. For example, it can happen that you switch to HTTPS, but many internal links continue to use HTTP. Browsers often recognize mixed content immediately and inform the user with warning messages about possible security risks. As mentioned, a tool that searches all database entries for http:// and switches to https:// can help here. Especially when integrating external resources, such as web fonts or API endpoints, you should make sure that these are also delivered via HTTPS.

Correct testing procedures are also important. Open your site in different browsers (Chrome, Firefox, Safari, Edge) and mobile devices after the changeover. This is the only way to ensure that your redirect and the correct certificate chain work everywhere. Sometimes older browsers block certain certificates or react sensitively to intermediate certificates, which is why you should choose a certificate from a reputable provider if in doubt.

If you have problems with forgotten certificate renewals, it is advisable to set up a notification function. Many hosters send automatic emails before expiry. With Let's Encrypt, automatic renewal usually takes place if your server configuration allows it. Non-renewed or expired certificates lead to clearly visible security warnings that unsettle users and often result in immediate termination.

Advantages for SEO and user trust

HTTPS has a demonstrable effect on your Visibility with Google. HTTPS has been one of the official ranking factors since 2014. Pages without a secure connection are now actively marked as "Not secure" - this can deter visitors and increase bounce rates. With the help of an SSL certificate and active redirection, you can create a basis of trust. The famous lock symbol in the address bar ensures that your visitors feel secure - especially with forms, password fields or store functions. A Effective encryption not only protects data, but also your reputation.

In addition to the pure security argument, performance also plays a role: modern protocols such as HTTP/2 or SSL/TLS optimizations often enable faster loading times compared to unencrypted connections. This also benefits your SEO ranking, as Google prefers fast-loading websites. In addition, users today are used to short loading times - every second of delay can lead to an increase in the bounce rate.

Increasing security awareness on the internet means that more and more users are specifically looking for the lock symbol in the address bar. If this is missing, many users cancel their visit to the site immediately as they fear that passwords or personal data could be intercepted. Especially when it comes to sensitive areas such as registration forms, orders or online banking, a convinced user can only be won over with an encrypted connection. HTTPS therefore makes a significant contribution to the overall user experience and is an important building block in the branding of your brand.

Comparison of leading hosting providers

A good hosting offer will help you to set up HTTPS quickly and without errors. Here is an overview of current providers:

Place Provider SSL included HTTPS forwarding Recommendation
1 webhoster.de Yes Yes Test winner
2 Provider B Yes Yes
3 Provider C Partial Yes

Go for a provider with an intuitive admin panel so that you can easily find all the settings you need. Also look out for automatic certificate renewal and comprehensive documentation for beginners.

Many hosters also offer all-round carefree packages in which all certificates are automatically managed and renewed. This significantly reduces the administrative workload. For agencies or operators of several websites in particular, it makes sense to choose a host that can bundle several domains or subdomains in one package. This will save you costs in the long term and reduce susceptibility to errors. Especially when it comes to security, it pays to use a high-quality service, as you are dependent on fast support in the event of an emergency.

Another aspect when comparing providers is the availability of support channels. Should you ever encounter problems - for example with nested redirects or incorrect DNS entries - competent support can make the difference between your website being quickly accessible again or remaining offline for days. Therefore, compare not only the prices, but also your time window for support requests and the resources that the host makes available to you (knowledge databases, live chat, community forums, etc.).

Final recommendation

HTTPS redirection is now part of the technical basis of every website. It protects your visitor data, increases visibility on Google and improves the overall user experience. With an active SSL certificate and simple redirect code, you can ensure that no request remains unsecured. If you use WordPress, a plugin such as Really Simple SSL will speed up the transition considerably. If you are considering switching to HTTPS permanently, avoid typical configuration errors right from the start. This will not only provide your visitors with encrypted access, but also a clear sign of professionalism.

In the long term, a comprehensive HTTPS strategy leads to more trust, better conversion rates and a significantly improved brand perception. Security is no longer a "nice-to-have", but an integral part of a reputable online presence. With updated certificates, smart server configurations and the integration of HSTS, you can make your website practically invulnerable to common man-in-the-middle attacks. A professionally implemented HTTPS setup can also give you considerable advantages for domain redirects or marketing campaigns, because visitors know right from the start that they are in good hands: I'm in good hands here.

Current articles