{"id":3562,"date":"2019-02-07T19:07:26","date_gmt":"2019-02-07T13:37:26","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=3562"},"modified":"2026-10-07T12:48:42","modified_gmt":"2026-10-07T07:18:42","slug":"force-http-to-https","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/force-http-to-https\/","title":{"rendered":"How to Force HTTPS on Your Website"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><strong>Post Date:<\/strong> February 7, 2019 <br><strong>Last Updated:<\/strong> October 07, 2026<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Introduction<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">This guide explains how to force HTTP traffic to redirect to HTTPS using <code>.htaccess<\/code>, so visitors always land on the secure version of your site regardless of which URL they originally typed or clicked.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Before starting, you need an SSL certificate already installed for your domain \u2014 this redirect doesn&#8217;t create encryption, it just ensures traffic uses the HTTPS connection you&#8217;ve already set up.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>An SSL certificate already installed and working for your domain<\/li>\n\n\n\n<li>Apache with <code>mod_rewrite<\/code> enabled<\/li>\n\n\n\n<li><code>AllowOverride All<\/code> permitted for your document root (otherwise Apache ignores <code>.htaccess<\/code> files entirely)<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Architecture<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A browser requests your site over plain HTTP<\/li>\n\n\n\n<li>Apache checks <code>.htaccess<\/code>, sees the request isn&#8217;t HTTPS, and sends back a 301 redirect<\/li>\n\n\n\n<li>The browser automatically requests the same page again, this time over HTTPS<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2019\/02\/HTTP-to-HTTPS-Redirect-Flow.png\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"368\" src=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2019\/02\/HTTP-to-HTTPS-Redirect-Flow-1024x368.png\" alt=\"\" class=\"wp-image-12149\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2019\/02\/HTTP-to-HTTPS-Redirect-Flow-1024x368.png 1024w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2019\/02\/HTTP-to-HTTPS-Redirect-Flow-300x108.png 300w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2019\/02\/HTTP-to-HTTPS-Redirect-Flow-768x276.png 768w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2019\/02\/HTTP-to-HTTPS-Redirect-Flow-1536x552.png 1536w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2019\/02\/HTTP-to-HTTPS-Redirect-Flow-2048x736.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Steps<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1. Edit Your .htaccess File<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">vi .htaccess\n<\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\"><strong>Note:<\/strong> The original guide had a typo in the filename \u2014 <code>.httacess<\/code> instead of <code>.htaccess<\/code>. Apache specifically looks for the file named <code>.htaccess<\/code>; anything else (including this typo) is silently ignored.<\/p>\n<\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\">2. Add the Redirect Rule<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">RewriteEngine On\nRewriteCond %{HTTPS} off\nRewriteRule ^(.*)$ https:\/\/%{HTTP_HOST}%{REQUEST_URI} [R=301,L]\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This redirects any HTTP request, for any domain pointed at this document root, to its HTTPS equivalent, preserving the original path.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">If you specifically want this rule to apply only to one domain among several sharing the same document root, add a host-matching condition above the <code>%{HTTPS} off<\/code> line:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">RewriteCond %{HTTP_HOST} ^yourdomain\\.com [NC]\n<\/pre>\n<\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\">3. Test It<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Save the file, clear your browser cache (or test in a private\/incognito window), and visit your site over <code>http:\/\/<\/code>. You should be redirected to <code>https:\/\/<\/code> automatically.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Forcing HTTP to HTTPS is a short <code>.htaccess<\/code> rule, as long as <code>mod_rewrite<\/code> is enabled and <code>AllowOverride All<\/code> is permitted for the directory \u2014 both of which are easy to overlook and are the most common reasons this rule appears to do nothing when added.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Frequently Asked Questions<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Why isn&#8217;t the redirect working even though I added the rule correctly?<\/strong> Check that the file is actually named <code>.htaccess<\/code> (not a typo like <code>.httacess<\/code>), that <code>mod_rewrite<\/code> is enabled, and that <code>AllowOverride All<\/code> is set for your document root \u2014 any one of these being wrong causes Apache to silently ignore the rule.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Do I need this if I&#8217;m using a reverse proxy or load balancer?<\/strong> Not necessarily \u2014 if your reverse proxy or load balancer already handles the HTTP-to-HTTPS redirect, adding this rule as well is redundant and adds an unnecessary extra hop.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Will this redirect break any existing bookmarks or links to my HTTP URLs?<\/strong> No \u2014 the 301 redirect preserves the original path, so an HTTP link still lands on the correct page, just over HTTPS.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Related Articles<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/how-to-enable-http2-support-in-apache\/\" target=\"_blank\" rel=\"noreferrer noopener\">How to enable HTTP2 support in Apache<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/redirect-http-to-https-with-windows-iis-10\/\" target=\"_blank\" rel=\"noreferrer noopener\">Redirect HTTP to HTTPS with Windows IIS 10<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Talk to Our Technology Experts<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Securing your website or setting up SSL across multiple domains? Our team can help with SSL\/TLS configuration, server security, and ongoing support.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/pheonixsolutions.com\/contact\">Connect with our technology experts.<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Post Date: February 7, 2019 Last Updated: October 07, 2026 Introduction This guide explains how to force HTTP traffic to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1022],"tags":[398],"class_list":["post-3562","post","type-post","status-publish","format-standard","hentry","category-web-architecture","tag-apache2","psol-cat-web-architecture"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/phn2x7-Vs","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/3562","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=3562"}],"version-history":[{"count":1,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/3562\/revisions"}],"predecessor-version":[{"id":12150,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/3562\/revisions\/12150"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=3562"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=3562"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=3562"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}