Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
...:::[TUTORIAL].htaccess - A way to keep secure[TUTORIAL]::...
#1
In this tutorial I will be going through the .htaccess file that can really keep your site secure and safe. I hope you enjoy reading and feedback and comments are always welcome so please reply below.


Index - Sections
  • URL Redirection
  • Changing Error Pages
  • Protecting folders and directories
  • Blocking specific users from your site
  • Set server time zone
  • Stop Script Execution
  • Secure your .htaccess


What is .htaccess?
.htaccess is a file that is run on an Apache server. The Apache server will read your .htacces file which will allow you to configure and customize the way your site appears to normal users with custom commands.


URL Redirection

This is really quite easy to implicate and simple to grasp. Please look at how to do it below:

SYNTAX
-
Code:
Redirect [Virtual URL to be redirected [Full or exact URL you want to redirect too]
EXAMPLE -
Code:
Redirect /olddir/file.html http://yoursite.com/newdi/file.html


Protecting Folders/Directories

This is again quite simple and is fantastic in my opinion, please read below:

SYNTAX - (One File!)
Code:
<Files secure.php>
AuthType Basic
AuthName “Password Required”
AuthUserFile /home/path/.htpasswd
Require valid-user
</Files>
SYNTAX - (Directory!)
Code:
resides
AuthType basic
AuthName “This directory is protected please leave”
AuthUserFile /home/path/.htpasswd
AuthGroupFile /dev/null
Require valid-user


Blocking Specific Users

This is a great way to stop users viewing your site all together. Makes it so they can't access or view any feature. You can also stop domains from viewing!

Here we have two main commands, 'deny' and 'allow'. Simply interchange as you wish.

SYNTAX -
Code:
order allow,deny
deny from 111.82.3.1
deny from 182.45.1.8.
allow from all
EXAMPLE
Code:
order allow,deny
deny from 123.45.6.7
deny from www.google.com
allow from all


Set Server Timezone

This isn't vital but I think it's useful:

SYNTAX -
Code:
SetEnv TZ [Location]
EXAMPLE -
Code:
SetEnv TZ America/Las_Vegas


Stop Script Execution

This command will stop certain script types from being executed on your site. Really good to stop upload such as shells or viruses

SYNTAX -
Code:
Options -ExecCGI
AddHandler cgi-script [file extension or file extensions separated with spaces]
EXAMPLE -
Code:
Options -ExecCGI
AddHandler cgi-script .pl .py .php .jsp .htm .shtml .sh .asp .cgi


Protect your .htaccess

This command will protect your .htaccess file from any unauthorized people accessing it:

SYNTAX -
Code:
<Files .htaccess>
order allow,deny
deny from all
</Files>



This now concludes my .htaccess tutorial. If this helped or if you have any feedback then please comment below.

Regards,

- Sam


Reply


Messages In This Thread
...:::[TUTORIAL].htaccess - A way to keep secure[TUTORIAL]::... - by Sam - 06-24-2010, 06:30 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [Tutorial] Rotating Signature Galaxy 0 663 10-24-2014, 09:47 AM
Last Post: Galaxy
  Unlimited Traffic to your site [Free][Tutorial] Jitty 3 1,185 04-16-2014, 08:56 AM
Last Post: cracker007
  HTML Video Tutorial Collection (7 Videos and growing) etcBro 1 712 06-05-2013, 08:44 AM
Last Post: Toxhicide
  How To Install A MyBB Theme [Written Tutorial] BreShiE 41 9,063 12-12-2011, 05:18 PM
Last Post: BreShiE
  000webhost Custom Error Pages Tutorial alabama 12 4,908 11-16-2011, 06:41 AM
Last Post: TalishHF

Forum Jump:


Users browsing this thread: 4 Guest(s)