How to Force HTTPS Using the .htaccess

Redirect All Web Traffic

To force all web traffic to use HTTPS insert the following lines of code in the .htaccess file in your website's root folder.

NOTE: If you have existing code in your .htacess, add this above where there are already rules with a similar starting prefix.

 RewriteEngine On
 RewriteCond %{HTTPS} !=on
 RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
  • 2 用戶發現這個有用
這篇文章有幫助嗎?

相關文章

What are cron jobs?

Cron jobs are routines that execute a script on any given interval. For instance, you may have a...

What are error pages?

Error pages are the pages displayed when a user tries to access a location on your site and...

How do I configure a cron job?

Login to cPanel. Locate and click on the "Cron Jobs" icon under the "Advanced" category....

What does Network Tools do?

Network Tools enables you to query a domain and retreieve relevant information about that domain....

How to create a PHP redirect

There are several ways to redirect a URL. This is useful for those looking to redirect requests...