Redirect HTTP Requests to HTTPS using .htaccess

Redirect HTTP requests to HTTPS using .htaccess by adding the following code to your website’s .htaccess file.

<IfModule mod_rewrite.c>
# Redirect to HTTPS RewriteEngine
On RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] # End Redirect to HTTPS
</IfModule>

Comment

There is no comment on this post. Be the first one.

Leave a comment