Selasa, 9 Ogos 2011

How to Install mod_rewrite to Linux (Slackware)

1. Must enable mod_rewrite in apache web server.
You can check using phpinfo();

Slackware 13.37 is already include this mod and ready to use.

2. Must edit httpd.conf, open using your favourite editor, find
directory
Option FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
directory

3. Change no 2 to
directory "var www htdocs"
Option FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
directory

Explanation 1: : put your directory which to protect, notice the slash is gone.

Explanation 2:Change AllowOverride None to AllowOverride All


4. Almost finish, create file name .htaccess inside folder /var/www/htdocs and write all the rule how to protect apache web server. I do not want to take risk, i type all the rule and save the file.(sometime when you use copy paste file does not save properly)

sample rule

Error Document 403 "Pencerobohan.. pencerobohan telah dikesan!"
RewriteEngine On
RewriteCond %{REQUEST_METHOD} (GET|POST) [NC]
RewriteCond %{HTTP_USER_AGENT}^.*(nessus|havij|libwww|perl|python|nikto|acunetix|morfeu|w3af).* [NC,OR]
RewriteCond %{QUERY_STRING}.*(union|select|cast|char|convert|declare|delete|drop|exec|insert|meta|script|hex|unhex|concat|set|truncate|update|).* [NC]
RewriteRule (.*) - [F,L]








Tiada ulasan:

Catat Ulasan