This article contain the basic htaccess rule which are needed more often. The command RewriteEngine On should be ON in order to update/alter the htaccess in case if the server rewrite engine is off else don’t need to write that .It is mandatory that this RewriteEngine is On else you won’t be able to update.

10 Basic rules ioof .htaccess

Rule 1:

  • This rule redirect http traffic to https for one domain . This command RewriteCond %{HTTPS}!on check’s that whether the https is on or not.

Rule 2 :

  • This rule allows to add a whitelist ips for one or multiple page.
  • This will allow only the specified ips to access the whole site .
  • This will allow only the specified ips to access the specific file that is being mentioned(wp-login.php) .

Rule 3:

  • This rule allows to find keyword in url and redirect to some defined path.

Rule 4:

  • This rule ensure www on all URLs.it forcefully add the www. with each url of its website.

Rule 5:

  • Some time we don’t want index.php/index.htm to be the first file to be accessed.this rule allows to add custom directory index file.in the rule 3 files are mentioned that-fore in case first file is not detected then move to next one .

Rule 6:

  • This rule add/Modify Environment Variables.its like adding a global variables .

Rule 7:

  • Some time we want to stop the execution of specific types extension this rule Disallow Script Execution.

Rule 8

  • This rule change’s Charset and Language headers

Rule 9

  • This rule allow as to restrict the Upload file limit for PHP.

Rule 10

  • we can add Custom error page by using the rule below.

Leave a Reply

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