Force https from .htaccess


What can you do with an htaccess?

  • Redirect a Domain to a Directory
  • Prevent Hacks in WordPress
  • Activate register-globals
  • 301 redirects
  • Avoid Directory Listing
  • Redirect domain without www to www

 

If you are a server administrator, you can perform this configuration in the httpd.conf file using the settings below. If you are not an administrator and use CPanel you can resolve the redirect using the .httaccess file. Enter in the folder that you want to redirect to HTTPS .htaccess with the following configuration

1.Create a plain, named text file .htaccess

2. Add the lines:

          RewriteEngine On
          RewriteCond % {HTTPS} off
          RewriteRule ^ (. *) $ https: // % {HTTP_HOST} % {REQUEST_URI} [L, R = 301]

3.Use your FTP client to upload the .htaccess file to the directory, or sub-directory, of the corresponding domain. If you want the file to be uploaded when entering your domain, you should upload the file to the root of your domain, which is usually within the public_html

 

 

 

 

 

Previous enable SSL in WordPress
Next the fastest operating system

No Comment

Leave a reply

Your email address will not be published. Required fields are marked *