CR Servers home
CR Servers home
HostingWeb Hosting
VPSVPS Servers
DedicatedDedicated Servers
ColocationColocation
Contact Us
HomeHomeServicesServicesDomainsDomains
Data CenterData Center

Network Connectivity

Power Infrastructure

Climate Control

Physical Security

SupportSupport

Open Support Ticket

Knowledge Base

Security Overview

Anti-Spam

Abuse Policy

AboutAbout Us

Partners

Privacy

InsightsIndustry Insights
  1. Home
  2. Support
  3. Knowledge base
  4. Hosting
  5. Force HTTPS: Redirect HTTP to HTTPS

​
​

Force HTTPS: Redirect HTTP to HTTPS

Send every visitor to the secure https:// version of your site with a short .htaccess rule, after the domain has an SSL certificate.

Once your domain has an SSL certificate, send visitors who type http:// to https:// automatically. Browsers stop showing "Not secure", and search engines index a single version of each page.

Before you start

The domain must already have a working certificate. Open https://yourdomain.com in your browser. If you see a certificate warning, a 403 error, or another site, fix SSL first. Redirecting to HTTPS without a certificate takes the site offline for visitors.

If you use WordPress, check Settings → General in WordPress: both addresses should start with https://. Many SSL plugins can also do this redirect; use one method, not both.

Add the redirect

  1. Open the file manager from the hosting control panel.
  2. Go to the site's html folder (yourdomain.com/html).
  3. Open .htaccess, or create it if it doesn't exist (New Item → file named .htaccess). If it already exists, download a copy first.
  4. Add these lines at the top of the file, above any # BEGIN WordPress block:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  1. Save.

This keeps the path and query string (http://yourdomain.com/contact?x=1 goes to https://yourdomain.com/contact?x=1) and works for every domain that uses that folder. 301 tells search engines the move is permanent.

Check it

  1. Open a private browser window.
  2. Go to http://yourdomain.com/some-page.
  3. The address bar should change to https://yourdomain.com/some-page and show the padlock.

You can also run curl -I http://yourdomain.com and look for 301 and a Location: https://… line.

Also send www to one version (optional)

To always use https://yourdomain.com without www, use this instead of the block above (change yourdomain\.com):

RewriteEngine On
RewriteCond %{HTTPS} !=on [OR]
RewriteCond %{HTTP_HOST} ^www\.yourdomain\.com$ [NC]
RewriteRule ^ https://yourdomain.com%{REQUEST_URI} [L,R=301]

Make sure the certificate covers both yourdomain.com and www.yourdomain.com.

If something goes wrong

  • "Too many redirects": you have two redirects fighting (a plugin and .htaccess, or the WordPress address still on http://). Remove one.
  • 500 error after saving: a typo in .htaccess. Restore your copy, then paste the lines again.
  • Another site or a 403 over HTTPS: the domain has no certificate. Remove the redirect and see Troubleshoot website errors.

More about the file: Edit the .htaccess file.

On this page

    Before you start
    Add the redirect
    Check it
    Also send www to one version (optional)
    If something goes wrong

Related articles

    Install a Free SSL Certificate (and When You Need a Dedicated IP)
    Edit the .htaccess file
    Troubleshoot Website Errors: 403, 500, 503 and Wrong Site Over HTTPS
Back to HostingAll guides

Need hands-on help?

Open a ticket and a CR Servers engineer will follow up with clear next steps.

Open a support ticketContact sales

On this page

    Before you start
    Add the redirect
    Check it
    Also send www to one version (optional)
    If something goes wrong

Related articles

    Install a Free SSL Certificate (and When You Need a Dedicated IP)
    Edit the .htaccess file
    Troubleshoot Website Errors: 403, 500, 503 and Wrong Site Over HTTPS

SERVICES

Web HostingAI ConnectDomainsVPS ServersColocationDedicated ServersResellersRefer a Friend

ABOUT CR SERVERS

About UsSupportClient AreaFAQTerms of ServicePrivacy PolicyData Center

Call us directly:

+506 2256-3944

WhatsApp:

+506 6059-2405

#509 Trifami, Avenida 1, Calle 2

San José, Costa Rica.

Secure payment methods:
Copyright © 2026 CR Servers - Sistemas Edenia Internacional S.A. | All rights reserved