{"id":21105,"date":"2025-10-14T10:00:06","date_gmt":"2025-10-14T10:00:06","guid":{"rendered":"https:\/\/www.webhosting.uk.com\/kb\/?p=21105"},"modified":"2026-03-24T12:13:58","modified_gmt":"2026-03-24T12:13:58","slug":"how-to-redirect-http-to-https-in-apache-step-by-step-guide","status":"publish","type":"post","link":"https:\/\/www.webhosting.uk.com\/kb\/how-to-redirect-http-to-https-in-apache-step-by-step-guide\/","title":{"rendered":"How to Redirect HTTP to HTTPS in Apache (Step-by-Step Guide)"},"content":{"rendered":"<p>Redirecting HTTP traffic to HTTPS is a crucial step in protecting your website, securing user data, and maintaining a strong SEO ranking. This guide explains how to redirect HTTP to HTTPS in Apache using two reliable methods: Virtual Host configuration and the .htaccess file.<\/p>\n<div class=\"more-tab-content\">\n<h2><strong>Table of Contents<\/strong><\/h2>\n<ol>\n<li><a href=\"#https\">Why Redirect HTTP to HTTPS?<\/a><\/li>\n<li><a href=\"#prerequisites\">Prerequisites<\/a><\/li>\n<li><a href=\"#virtual\">Method 1: Redirect Using Apache Virtual Host<\/a><\/li>\n<li><a href=\"#htaccess\">Method 2: Redirect Using .htaccess<\/a><a name=\"https\"><\/a><\/li>\n<li><a href=\"#redirect\">How to Verify the HTTPS Redirect<\/a><\/li>\n<li><a href=\"#issues\">Troubleshooting Common Issues<\/a><\/li>\n<li><a href=\"#conclusion\">Conclusion<\/a><\/li>\n<\/ol>\n<\/div>\n<h3><strong>Why Redirect HTTP to HTTPS?<\/strong><\/h3>\n<p>When a website runs over HTTPS, it uses SSL\/TLS encryption to secure the connection between the browser and server. Redirecting HTTP to HTTPS guarantees:<\/p>\n<ul>\n<li>Improved Security: Protects sensitive user data from being blocked.<\/li>\n<li>SEO Benefits: Search engines prioritise secure websites (HTTPS).<\/li>\n<li>User Trust: Displays the padlock icon, assuring visitors that the site is safe.<\/li>\n<li>Consistency: <a name=\"prerequisites\"><\/a>Prevents duplicate content across HTTP and HTTPS versions.<\/li>\n<\/ul>\n<h3><strong>Prerequisites<\/strong><\/h3>\n<p>Before you begin, ensure that your server meets the following requirements. You should have Apache installed and running properly on your system. A valid SSL\/TLS certificate must also be <a name=\"virtual\"><\/a>installed on your domain to enable secure HTTPS connections. Additionally, you need root or sudo access to make the necessary configuration changes in Apache\u2019s files.<\/p>\n<h3><strong>Method 1: Redirect Using Apache Virtual Host<\/strong><\/h3>\n<p>This is the most reliable method for implementing HTTPS redirection.<\/p>\n<ol>\n<li>Open the Apache Configuration File. Depending on your system, the configuration file is usually located at:\n<pre>\/etc\/apache2\/sites-available\/example.conf # Ubuntu\/Debian\r\n\/etc\/httpd\/conf.d\/example.conf\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 # CentOS\/RHEL<\/pre>\n<\/li>\n<li>Open the file using the command below:\n<pre>sudo nano \/etc\/apache2\/sites-available\/example.conf<\/pre>\n<\/li>\n<li>Add a Redirect Rule in the HTTP Virtual Host by inserting the subsequent configuration:\n<pre>&lt;VirtualHost *:80&gt;\r\nServerName example.com\r\nServerAlias <a href=\"http:\/\/www.example.com\">example.com<\/a>\r\nRedirect permanent \/ https:\/\/example.com\/\r\n&lt;\/VirtualHost&gt;<\/pre>\n<\/li>\n<li>Enable Required Apache Modules by executing the following commands:\n<pre>sudo a2enmod ssl\r\nsudo a2enmod rewrite<\/pre>\n<\/li>\n<li>Restart Apache:\n<pre>sudo systemctl restart apache2<\/pre>\n<p><em>(Use sudo <a name=\"htaccess\"><\/a>systemctl restart httpd for CentOS\/RHEL)<\/em><\/li>\n<\/ol>\n<h3><strong>Method 2: Redirect Using .htaccess<\/strong><\/h3>\n<p>If you don\u2019t have access to Virtual Host files, you can use the .htaccess file.<\/p>\n<ol>\n<li>Open or create the .htaccess file by executing the following command:\n<pre>sudo nano \/var\/www\/html\/.htaccess<\/pre>\n<\/li>\n<li>Add the Rewrite Rules:\n<pre>RewriteEngine On\r\nRewriteCond %{HTTPS} off\r\nRewriteRule ^(.*)$ https:\/\/%{HTTP_HOST}%{REQUEST_URI} [L,R=301]<\/pre>\n<\/li>\n<li>Enable .htaccess Overrides in your Apache configuration, ensure that AllowOverride is set to \u2018All\u2019:\n<pre>&lt;Directory \/var\/www\/html&gt;\r\nAllowOverride All\r\n&lt;\/Directory&gt;<\/pre>\n<\/li>\n<li>Then <a name=\"redirect\"><\/a>restart Apache with:\n<pre>sudo systemctl restart apache2<\/pre>\n<\/li>\n<\/ol>\n<h3><strong>How to Verify the HTTPS Redirect<\/strong><\/h3>\n<p>After finishing the configuration, you should check if the redirection is working properly.<\/p>\n<p><strong>Check in your web browser<\/strong><\/p>\n<ol>\n<li>Open your browser and type:\n<pre>http:\/\/example.com<\/pre>\n<\/li>\n<li>It should automatically redirect to:\n<pre>https:\/\/example.com<\/pre>\n<\/li>\n<\/ol>\n<p><strong>Check using the cURL command<\/strong><\/p>\n<ol>\n<li>You can also verify it from the terminal by running:\n<pre>curl -I http:\/\/example.com<\/pre>\n<\/li>\n<li>If the redirect<a name=\"issues\"><\/a> is successful, you will see a response like this:\n<pre>HTTP\/1.1 301 Moved Permanently\r\nLocation: https:\/\/example.com\/<\/pre>\n<\/li>\n<\/ol>\n<h3><strong>Troubleshooting Common Issues<\/strong><\/h3>\n<ul>\n<li>Redirect not working: Ensure mod_rewrite is enabled (sudo a2enmod rewrite).<\/li>\n<li>SSL certificate error: Verify that your SSL certificate is properly installed.<\/li>\n<li>.htaccess ignored: Set AllowOverride All in Apache configuration.<\/li>\n<li>Infinite redirect loop: <a name=\"conclusion\"><\/a>Clear browser cache and check for identical redirect rules in configuration files.<\/li>\n<li>Check the Apache logs for details by running the following command:\n<pre>sudo tail -f \/var\/log\/apache2\/error.log<\/pre>\n<\/li>\n<\/ul>\n<h3><strong>Conclusion<\/strong><\/h3>\n<p>In this manner, redirecting HTTP to HTTPS in Apache ensures your website remains safe, professional, and search-engine-friendly.<br \/>\nYou can enforce SSL and secure your visitors\u2019 data using either the Virtual Host or .htaccess method. If you encounter any issues, our support team is always available to assist you.<\/p>\n<div style=\"background:#E6F0FF; padding:15px; border-left:4px solid #0047BA; margin:20px 0;\">\n<strong>Configuring HTTPS for your website?<\/strong><br \/>\nFor full control over SSL and server configuration, consider using a <a href=\"https:\/\/www.webhosting.uk.com\/linux-vps\">Linux VPS with dedicated resources<\/a>.\n<\/div>\n<p style=\"text-align: center;\"><em><strong>Planning to secure your Joomla site too? Learn <a href=\"https:\/\/www.webhosting.uk.com\/kb\/how-to-migrate-a-joomla-site-from-http-to-https\/\"> How to migrate a Joomla site from HTTP to HTTPS<\/a><\/strong><\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Redirecting HTTP traffic to HTTPS is a crucial step in protecting your website, securing user data, and maintaining a strong SEO ranking. This guide explains how to redirect HTTP to&hellip;<\/p>\n<p><a href=\"https:\/\/www.webhosting.uk.com\/kb\/how-to-redirect-http-to-https-in-apache-step-by-step-guide\/\" class=\"more-link\">Read More<\/a><\/p>\n<div class='heateorSssClear'><\/div><div  class='heateor_sss_sharing_container heateor_sss_horizontal_sharing' data-heateor-sss-href='https:\/\/www.webhosting.uk.com\/kb\/how-to-redirect-http-to-https-in-apache-step-by-step-guide\/'><div class='heateor_sss_sharing_title' style=\"font-weight:bold\" >Spread the love<\/div><div class=\"heateor_sss_sharing_ul\"><a aria-label=\"Facebook\" class=\"heateor_sss_facebook\" href=\"https:\/\/www.facebook.com\/sharer\/sharer.php?u=https%3A%2F%2Fwww.webhosting.uk.com%2Fkb%2Fhow-to-redirect-http-to-https-in-apache-step-by-step-guide%2F\" title=\"Facebook\" rel=\"nofollow noopener\" target=\"_blank\" style=\"font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle\"><span class=\"heateor_sss_svg\" style=\"background-color:#0765FE;width:40px;height:40px;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;box-sizing:content-box\"><svg style=\"display:block;\" focusable=\"false\" aria-hidden=\"true\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"100%\" height=\"100%\" viewBox=\"0 0 32 32\"><path fill=\"#fff\" d=\"M28 16c0-6.627-5.373-12-12-12S4 9.373 4 16c0 5.628 3.875 10.35 9.101 11.647v-7.98h-2.474V16H13.1v-1.58c0-4.085 1.849-5.978 5.859-5.978.76 0 2.072.15 2.608.298v3.325c-.283-.03-.775-.045-1.386-.045-1.967 0-2.728.745-2.728 2.683V16h3.92l-.673 3.667h-3.247v8.245C23.395 27.195 28 22.135 28 16Z\"><\/path><\/svg><\/span><\/a><a aria-label=\"X\" class=\"heateor_sss_button_x\" href=\"https:\/\/twitter.com\/intent\/tweet?text=Redirect%20HTTP%20to%20HTTPS%20in%20Apache%3A%20Step-by-Step&url=https%3A%2F%2Fwww.webhosting.uk.com%2Fkb%2Fhow-to-redirect-http-to-https-in-apache-step-by-step-guide%2F\" title=\"X\" rel=\"nofollow noopener\" target=\"_blank\" style=\"font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle\"><span class=\"heateor_sss_svg heateor_sss_s__default heateor_sss_s_x\" style=\"background-color:#2a2a2a;width:40px;height:40px;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;box-sizing:content-box\"><svg width=\"100%\" height=\"100%\" style=\"display:block;\" focusable=\"false\" aria-hidden=\"true\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 32 32\"><path fill=\"#fff\" d=\"M21.751 7h3.067l-6.7 7.658L26 25.078h-6.172l-4.833-6.32-5.531 6.32h-3.07l7.167-8.19L6 7h6.328l4.37 5.777L21.75 7Zm-1.076 16.242h1.7L11.404 8.74H9.58l11.094 14.503Z\"><\/path><\/svg><\/span><\/a><a aria-label=\"Linkedin\" class=\"heateor_sss_button_linkedin\" href=\"https:\/\/www.linkedin.com\/sharing\/share-offsite\/?url=https%3A%2F%2Fwww.webhosting.uk.com%2Fkb%2Fhow-to-redirect-http-to-https-in-apache-step-by-step-guide%2F\" title=\"Linkedin\" rel=\"nofollow noopener\" target=\"_blank\" style=\"font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle\"><span class=\"heateor_sss_svg heateor_sss_s__default heateor_sss_s_linkedin\" style=\"background-color:#0077b5;width:40px;height:40px;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;box-sizing:content-box\"><svg style=\"display:block;\" focusable=\"false\" aria-hidden=\"true\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"100%\" height=\"100%\" viewBox=\"0 0 32 32\"><path d=\"M6.227 12.61h4.19v13.48h-4.19V12.61zm2.095-6.7a2.43 2.43 0 0 1 0 4.86c-1.344 0-2.428-1.09-2.428-2.43s1.084-2.43 2.428-2.43m4.72 6.7h4.02v1.84h.058c.56-1.058 1.927-2.176 3.965-2.176 4.238 0 5.02 2.792 5.02 6.42v7.395h-4.183v-6.56c0-1.564-.03-3.574-2.178-3.574-2.18 0-2.514 1.7-2.514 3.46v6.668h-4.187V12.61z\" fill=\"#fff\"><\/path><\/svg><\/span><\/a><\/div><div class=\"heateorSssClear\"><\/div><\/div><div class='heateorSssClear'><\/div>","protected":false},"author":28,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1409],"tags":[205],"class_list":["post-21105","post","type-post","status-publish","format-standard","hentry","category-server","tag-servers"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.9 (Yoast SEO v27.9) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Apache2 Redirect HTTP to HTTPS (.htaccess + Config Guide)<\/title>\n<meta name=\"description\" content=\"Redirect HTTP to HTTPS in Apache2 using .htaccess or config. Step-by-step rewrite rules and examples for secure redirection.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.webhosting.uk.com\/kb\/how-to-redirect-http-to-https-in-apache-step-by-step-guide\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Redirect HTTP to HTTPS in Apache: Step-by-Step\" \/>\n<meta property=\"og:description\" content=\"Learn how to redirect HTTP to HTTPS in Apache with a step-by-step guide to secure your website, protect user data, and improve SEO\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webhosting.uk.com\/kb\/how-to-redirect-http-to-https-in-apache-step-by-step-guide\/\" \/>\n<meta property=\"og:site_name\" content=\"Webhosting UK Knowledge Base\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webhostingukcom\" \/>\n<meta property=\"article:published_time\" content=\"2025-10-14T10:00:06+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-03-24T12:13:58+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webhosting.uk.com\/kb\/wp-content\/uploads\/2023\/08\/WHUK-logo-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Victor G\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"Redirect HTTP to HTTPS in Apache: Step-by-Step\" \/>\n<meta name=\"twitter:description\" content=\"Learn how to redirect HTTP to HTTPS in Apache with a step-by-step guide to secure your website, protect user data, and improve SEO\" \/>\n<meta name=\"twitter:creator\" content=\"@WebhostingUKcom\" \/>\n<meta name=\"twitter:site\" content=\"@WebhostingUKcom\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.webhosting.uk.com\\\/kb\\\/how-to-redirect-http-to-https-in-apache-step-by-step-guide\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.webhosting.uk.com\\\/kb\\\/how-to-redirect-http-to-https-in-apache-step-by-step-guide\\\/\"},\"author\":{\"name\":\"Victor G\",\"@id\":\"https:\\\/\\\/www.webhosting.uk.com\\\/kb\\\/#\\\/schema\\\/person\\\/ea067684eae84c2b8b49a81c69407297\"},\"headline\":\"How to Redirect HTTP to HTTPS in Apache (Step-by-Step Guide)\",\"datePublished\":\"2025-10-14T10:00:06+00:00\",\"dateModified\":\"2026-03-24T12:13:58+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.webhosting.uk.com\\\/kb\\\/how-to-redirect-http-to-https-in-apache-step-by-step-guide\\\/\"},\"wordCount\":543,\"publisher\":{\"@id\":\"https:\\\/\\\/www.webhosting.uk.com\\\/kb\\\/#organization\"},\"keywords\":[\"Servers\"],\"articleSection\":[\"Servers, Hosting &amp; Email\"],\"inLanguage\":\"en-GB\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.webhosting.uk.com\\\/kb\\\/how-to-redirect-http-to-https-in-apache-step-by-step-guide\\\/\",\"url\":\"https:\\\/\\\/www.webhosting.uk.com\\\/kb\\\/how-to-redirect-http-to-https-in-apache-step-by-step-guide\\\/\",\"name\":\"Apache2 Redirect HTTP to HTTPS (.htaccess + Config Guide)\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.webhosting.uk.com\\\/kb\\\/#website\"},\"datePublished\":\"2025-10-14T10:00:06+00:00\",\"dateModified\":\"2026-03-24T12:13:58+00:00\",\"description\":\"Redirect HTTP to HTTPS in Apache2 using .htaccess or config. Step-by-step rewrite rules and examples for secure redirection.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.webhosting.uk.com\\\/kb\\\/how-to-redirect-http-to-https-in-apache-step-by-step-guide\\\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.webhosting.uk.com\\\/kb\\\/how-to-redirect-http-to-https-in-apache-step-by-step-guide\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.webhosting.uk.com\\\/kb\\\/how-to-redirect-http-to-https-in-apache-step-by-step-guide\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.webhosting.uk.com\\\/kb\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Redirect HTTP to HTTPS in Apache (Step-by-Step Guide)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.webhosting.uk.com\\\/kb\\\/#website\",\"url\":\"https:\\\/\\\/www.webhosting.uk.com\\\/kb\\\/\",\"name\":\"Webhosting UK Knowledge Base\",\"description\":\"Expert Insights on Hosting, Development, Security, Marketing, and SEO\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.webhosting.uk.com\\\/kb\\\/#organization\"},\"alternateName\":\"WHUK\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.webhosting.uk.com\\\/kb\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.webhosting.uk.com\\\/kb\\\/#organization\",\"name\":\"Webhosting UK\",\"alternateName\":\"WHUK\",\"url\":\"https:\\\/\\\/www.webhosting.uk.com\\\/kb\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/www.webhosting.uk.com\\\/kb\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.webhosting.uk.com\\\/kb\\\/wp-content\\\/uploads\\\/2023\\\/08\\\/WHUK-logo-1.png\",\"contentUrl\":\"https:\\\/\\\/www.webhosting.uk.com\\\/kb\\\/wp-content\\\/uploads\\\/2023\\\/08\\\/WHUK-logo-1.png\",\"width\":1200,\"height\":628,\"caption\":\"Webhosting UK\"},\"image\":{\"@id\":\"https:\\\/\\\/www.webhosting.uk.com\\\/kb\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/webhostingukcom\",\"https:\\\/\\\/x.com\\\/WebhostingUKcom\",\"https:\\\/\\\/www.youtube.com\\\/c\\\/webhostinguk\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/webhosting-uk-com-ltd\\\/\",\"https:\\\/\\\/www.instagram.com\\\/webhosting_uk\\\/\",\"https:\\\/\\\/www.tiktok.com\\\/@webhostinguk\"],\"description\":\"Fast, reliable, and cost-effective website hosting services with Webhosting UK. Committed to providing you secure support around the clock.\",\"email\":\"sales@webhosting.uk.com\",\"telephone\":\"0800 862 0890\",\"legalName\":\"Webhosting UK\",\"foundingDate\":\"2001-02-07\",\"numberOfEmployees\":{\"@type\":\"QuantitativeValue\",\"minValue\":\"51\",\"maxValue\":\"200\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.webhosting.uk.com\\\/kb\\\/#\\\/schema\\\/person\\\/ea067684eae84c2b8b49a81c69407297\",\"name\":\"Victor G\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9bf0713adcbaded4878508c93d93927ecbfa4f74548fd9bcee41478d8768bd66?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9bf0713adcbaded4878508c93d93927ecbfa4f74548fd9bcee41478d8768bd66?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9bf0713adcbaded4878508c93d93927ecbfa4f74548fd9bcee41478d8768bd66?s=96&d=mm&r=g\",\"caption\":\"Victor G\"}}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Apache2 Redirect HTTP to HTTPS (.htaccess + Config Guide)","description":"Redirect HTTP to HTTPS in Apache2 using .htaccess or config. Step-by-step rewrite rules and examples for secure redirection.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.webhosting.uk.com\/kb\/how-to-redirect-http-to-https-in-apache-step-by-step-guide\/","og_locale":"en_GB","og_type":"article","og_title":"Redirect HTTP to HTTPS in Apache: Step-by-Step","og_description":"Learn how to redirect HTTP to HTTPS in Apache with a step-by-step guide to secure your website, protect user data, and improve SEO","og_url":"https:\/\/www.webhosting.uk.com\/kb\/how-to-redirect-http-to-https-in-apache-step-by-step-guide\/","og_site_name":"Webhosting UK Knowledge Base","article_publisher":"https:\/\/www.facebook.com\/webhostingukcom","article_published_time":"2025-10-14T10:00:06+00:00","article_modified_time":"2026-03-24T12:13:58+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/www.webhosting.uk.com\/kb\/wp-content\/uploads\/2023\/08\/WHUK-logo-1.png","type":"image\/png"}],"author":"Victor G","twitter_card":"summary_large_image","twitter_title":"Redirect HTTP to HTTPS in Apache: Step-by-Step","twitter_description":"Learn how to redirect HTTP to HTTPS in Apache with a step-by-step guide to secure your website, protect user data, and improve SEO","twitter_creator":"@WebhostingUKcom","twitter_site":"@WebhostingUKcom","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.webhosting.uk.com\/kb\/how-to-redirect-http-to-https-in-apache-step-by-step-guide\/#article","isPartOf":{"@id":"https:\/\/www.webhosting.uk.com\/kb\/how-to-redirect-http-to-https-in-apache-step-by-step-guide\/"},"author":{"name":"Victor G","@id":"https:\/\/www.webhosting.uk.com\/kb\/#\/schema\/person\/ea067684eae84c2b8b49a81c69407297"},"headline":"How to Redirect HTTP to HTTPS in Apache (Step-by-Step Guide)","datePublished":"2025-10-14T10:00:06+00:00","dateModified":"2026-03-24T12:13:58+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webhosting.uk.com\/kb\/how-to-redirect-http-to-https-in-apache-step-by-step-guide\/"},"wordCount":543,"publisher":{"@id":"https:\/\/www.webhosting.uk.com\/kb\/#organization"},"keywords":["Servers"],"articleSection":["Servers, Hosting &amp; Email"],"inLanguage":"en-GB"},{"@type":"WebPage","@id":"https:\/\/www.webhosting.uk.com\/kb\/how-to-redirect-http-to-https-in-apache-step-by-step-guide\/","url":"https:\/\/www.webhosting.uk.com\/kb\/how-to-redirect-http-to-https-in-apache-step-by-step-guide\/","name":"Apache2 Redirect HTTP to HTTPS (.htaccess + Config Guide)","isPartOf":{"@id":"https:\/\/www.webhosting.uk.com\/kb\/#website"},"datePublished":"2025-10-14T10:00:06+00:00","dateModified":"2026-03-24T12:13:58+00:00","description":"Redirect HTTP to HTTPS in Apache2 using .htaccess or config. Step-by-step rewrite rules and examples for secure redirection.","breadcrumb":{"@id":"https:\/\/www.webhosting.uk.com\/kb\/how-to-redirect-http-to-https-in-apache-step-by-step-guide\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webhosting.uk.com\/kb\/how-to-redirect-http-to-https-in-apache-step-by-step-guide\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.webhosting.uk.com\/kb\/how-to-redirect-http-to-https-in-apache-step-by-step-guide\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.webhosting.uk.com\/kb\/"},{"@type":"ListItem","position":2,"name":"How to Redirect HTTP to HTTPS in Apache (Step-by-Step Guide)"}]},{"@type":"WebSite","@id":"https:\/\/www.webhosting.uk.com\/kb\/#website","url":"https:\/\/www.webhosting.uk.com\/kb\/","name":"Webhosting UK Knowledge Base","description":"Expert Insights on Hosting, Development, Security, Marketing, and SEO","publisher":{"@id":"https:\/\/www.webhosting.uk.com\/kb\/#organization"},"alternateName":"WHUK","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webhosting.uk.com\/kb\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Organization","@id":"https:\/\/www.webhosting.uk.com\/kb\/#organization","name":"Webhosting UK","alternateName":"WHUK","url":"https:\/\/www.webhosting.uk.com\/kb\/","logo":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/www.webhosting.uk.com\/kb\/#\/schema\/logo\/image\/","url":"https:\/\/www.webhosting.uk.com\/kb\/wp-content\/uploads\/2023\/08\/WHUK-logo-1.png","contentUrl":"https:\/\/www.webhosting.uk.com\/kb\/wp-content\/uploads\/2023\/08\/WHUK-logo-1.png","width":1200,"height":628,"caption":"Webhosting UK"},"image":{"@id":"https:\/\/www.webhosting.uk.com\/kb\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webhostingukcom","https:\/\/x.com\/WebhostingUKcom","https:\/\/www.youtube.com\/c\/webhostinguk","https:\/\/www.linkedin.com\/company\/webhosting-uk-com-ltd\/","https:\/\/www.instagram.com\/webhosting_uk\/","https:\/\/www.tiktok.com\/@webhostinguk"],"description":"Fast, reliable, and cost-effective website hosting services with Webhosting UK. Committed to providing you secure support around the clock.","email":"sales@webhosting.uk.com","telephone":"0800 862 0890","legalName":"Webhosting UK","foundingDate":"2001-02-07","numberOfEmployees":{"@type":"QuantitativeValue","minValue":"51","maxValue":"200"}},{"@type":"Person","@id":"https:\/\/www.webhosting.uk.com\/kb\/#\/schema\/person\/ea067684eae84c2b8b49a81c69407297","name":"Victor G","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/secure.gravatar.com\/avatar\/9bf0713adcbaded4878508c93d93927ecbfa4f74548fd9bcee41478d8768bd66?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/9bf0713adcbaded4878508c93d93927ecbfa4f74548fd9bcee41478d8768bd66?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/9bf0713adcbaded4878508c93d93927ecbfa4f74548fd9bcee41478d8768bd66?s=96&d=mm&r=g","caption":"Victor G"}}]}},"_links":{"self":[{"href":"https:\/\/www.webhosting.uk.com\/kb\/wp-json\/wp\/v2\/posts\/21105","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webhosting.uk.com\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webhosting.uk.com\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webhosting.uk.com\/kb\/wp-json\/wp\/v2\/users\/28"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webhosting.uk.com\/kb\/wp-json\/wp\/v2\/comments?post=21105"}],"version-history":[{"count":12,"href":"https:\/\/www.webhosting.uk.com\/kb\/wp-json\/wp\/v2\/posts\/21105\/revisions"}],"predecessor-version":[{"id":22636,"href":"https:\/\/www.webhosting.uk.com\/kb\/wp-json\/wp\/v2\/posts\/21105\/revisions\/22636"}],"wp:attachment":[{"href":"https:\/\/www.webhosting.uk.com\/kb\/wp-json\/wp\/v2\/media?parent=21105"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webhosting.uk.com\/kb\/wp-json\/wp\/v2\/categories?post=21105"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webhosting.uk.com\/kb\/wp-json\/wp\/v2\/tags?post=21105"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}