How do I implement a subdirectory forcing HTTPS address access in an Apache environment? In this article, we will share with you how to modify the. htaccess file in the Apache environment to implement a subdirectory forcing HTTPS address access.
1, root directory domain name. Even more simple, add the following code to the. htaccess file, and remember to change it to your domain name.
Rewriteengine onrewritecond%{server_port}rewriterule^ (. *)$ https ://www. website domain name. com/$1 [r,l]
2, sub-directory implementation Force jump HTTPS access. The following code will take effect for the. htaccess file of the current site root directory.
Rewriteengine onrewritecond%{server_port}rewritecond%{Request_uri } subdirectory folder rewriterule^ (. *)$ https://www. Our domain name. com/subdirectory folder [r,l]
Apache environment modifies. htaccess files to implement subdirectories forcing HTTPS access