MyBe This .htaccess Code Can Help To Secure Ur Url

Started on the old forum in February 2011 · view the original in the archive · old links redirect here

21 replies · 1,293 views · started 15 years ago · 2 min read

TL;DR · summary of 21 replies
  • - The code in .htaccess is meant to secure URLs and force PHP5 usage instead of PHP4.
  • - To fix HTTP Error 500, one should check if Options +FollowSymlinks needs to be enabled or disabled based on the host's configuration.
  • - Adding directives like AddType x-mapp-php5 .php for 1&1 web hosting is a common solution but varies by host.
  • - The thread did not resolve how to avoid hacking techniques using htaccess.

Written automatically from the replies by a language model on our own server. It can be wrong; the posts below are the source.

6 participants
Nahar Developer · 196 posts #1

SECURE .HTACCESS

If for some strange reason your host does not have +FollowSymlinks enabled by default at

the root level then you will need to enable Options +FollowSymlinks for mod_rewrite to work.

If you are getting HTTP Error 500 Internal server errors and you have checked to make sure

everything else is set correctly then remove the # sign in front of Options +FollowSymlinks

below. If you are still getting 500 errors then immediately put the # sign back. All hosts

these days should have this enabled by default. Enabling this will actually cause 500 server

errors if your host has this enabled so you should probably never have to remove the # sign.

Options +FollowSymlinks

These are some common Apache Directives to force PHP5 to be used instead of PHP4

Some web hosts have very specific directives - check with your web host first

Remove the pound sign in front of AddType x-mapp-php5 .php for 1&1 web hosting

AddType x-mapp-php5 .php

Other common possibilities depending on your web host - check with your web host first

AddHandler application/x-httpd-php5 .php

AddHandler cgi-php5 .php

Options -Indexes

BEGIN Nahar

<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule>

END Nahar

If you want to add a custom 403 Forbidden page for your website uncomment the

detailed instructions on how to do this.

ErrorDocument 403 /forbidden.html

QUERY STRING EXPLOITS

RewriteCond %{QUERY_STRING} ../ [NC,OR] RewriteCond %{QUERY_STRING} boot.ini [NC,OR] RewriteCond %{QUERY_STRING} tag= [NC,OR] RewriteCond %{QUERY_STRING} ftp: [NC,OR] RewriteCond %{QUERY_STRING} http: [NC,OR] RewriteCond %{QUERY_STRING} https: [NC,OR] RewriteCond %{QUERY_STRING} (<|%3C).script.(>|%3E) [NC,OR] RewriteCond %{QUERY_STRING} (<|%3C).iframe.(>|%3E) [NC,OR] RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|%3D) [NC,OR] RewriteCond %{QUERY_STRING} base64_encode.(.) [NC,OR] RewriteCond %{QUERY_STRING} GLOBALS(=|[|%[0-9A-Z]{0,2}) [OR] RewriteCond %{QUERY_STRING} _REQUEST(=|[|%[0-9A-Z]{0,2}) [OR] RewriteCond %{QUERY_STRING} ^(.)cPath=http://(.)$ [NC,OR] RewriteCond %{QUERY_STRING} ^(.)/self/(.)$ [NC,OR] RewriteCond %{QUERY_STRING} ^.([|]|(|)|<|>). [NC,OR] RewriteCond %{QUERY_STRING} ^.(globals|encode|localhost|loopback). [NC,OR] RewriteCond %{QUERY_STRING} ^.(execute|exec|sp_executesql|request|select|insert|union|declare|drop|delete|create|alter|update|order|char|set|cast|convert|meta|script|truncate). [NC] RewriteRule ^(.*)$ - [F,L]

Deny Access to config.php, /inc/config.inc.php, all .htaccess files

php.ini, php5.ini and the WordPress readme.html installation file.

To allow only yourself access to these files add your IP address below

<FilesMatch "^(include.php|install.php|.htaccess|php.ini|php5.ini|readme.html)"> Deny from all

Allow from xxx.xxx.xxx.xxx <==Your IP

</FilesMatch>

Hmm..If This Post Not Usefull, Just Trash It 🙂

warfrek Junior · 44 posts #3

this is a good tutorial!thanks!

ewanz Developer · 187 posts #4

It als0 can sl0w y0ur server l0l..

Added after 7 minutes:

Yeah, i agree with rayjee but i already use this before 0n my site.. I got some trouble with .sis, exe and a lot of file...

our lfe is simple words.... 😌 http://mygenkz.net ewanz06@yahoo.com

$output="i am NOoob....";
$newfile="ewanz.txt";
$file = fopen ($newfile, "w");
fwrite($file, $output);
fclose ($file); 
Nahar Developer · 196 posts #5

m In VPS So i Dont Think my Server Will Slow

ewanz Developer · 187 posts #6

It must have a huge m0ney t0 p00r pers0n like me t0 buy vps and the c0nclusi0n here.. As the big usage in .htaccess as the high server usage

our lfe is simple words.... 😌 http://mygenkz.net ewanz06@yahoo.com

$output="i am NOoob....";
$newfile="ewanz.txt";
$file = fopen ($newfile, "w");
fwrite($file, $output);
fclose ($file); 
Nahar Developer · 196 posts #7

Just For 6 Month.. Nvm m8..m Tired For Fighting.. m In Bad Mood + Sad bCoz My birthday Is Upon Us And This Is My First Time Celebrating a Birthday Without a Mother 🙁

awan Junior · 28 posts #8

copypaste

the code is , copy paste from . . . Wordpress !

I'm not good but wanted to be clever 🙂

Nahar Developer · 196 posts #12

awan wrote: the code is , copy paste from . . . Wordpress !

LoL..Just Wordpress Can Use This .htaccess?? u Can Learn By Blueproof n Btw, i Learn ,htaccess Code From There.. u Just Know Post n Dont Know Wht Is Tht?? ua So Funny awan..Did u Site Secure Now??LoL

awan Junior · 28 posts #13

Nahar wrote: LoL..Just Wordpress Can Use This .htaccess?? u Can Learn By Blueproof n Btw, i Learn ,htaccess Code From There.. u Just Know Post n Dont Know Wht Is Tht?? ua So Funny awan..Did u Site Secure Now??LoL

Actually ,I already have this code in my htaccess ,thnx 4 inf0.

,senior members , u have a any htaccess code for avoid any hacking tecnique ?

I'm not good but wanted to be clever 🙂

Nahar Developer · 196 posts #14

Stop Use FREE HOST bCoz Its CRAP!! LoL..Ur Script Is Already Secure, m Just Coming From Ur Cpanel..LoL

Added after 5 minutes:

Btw m8..DId u Know Celcom Broadband User "CANT" Surf Ur Site..

awan Junior · 28 posts #15

Nahar wrote: Stop Use FREE HOST bCoz Its CRAP!! LoL..Ur Script Is Already Secure, m Just Coming From Ur Cpanel..LoL

Added after 5 minutes:

Btw m8..DId u Know Celcom Broadband User "CANT" Surf Ur Site..

Give my email back..if u wanted to give back. .

Actually . I kn0w about this problem . . My wap cann0t open via pc , because my f**king host . Doest now allow wap . Running on pc , but , can open it using mobile . Damn it !

I'm not good but wanted to be clever 🙂

Nahar Developer · 196 posts #16

LoL..u Have 117 Inbox Brother.. i Think m Already Ask u About Host Ryt??So Think About It 🙂

awan Junior · 28 posts #17

Nahar wrote: LoL..u Have 117 Inbox Brother.. i Think m Already Ask u About Host Ryt??So Think About It :)

Host? Haha . Demo please . . If you mean . Vista panel host sorry im n0t intrested , lol . Like u say wht Stop Use FREE HOST bCoz Its CRAP!! N0w u offering me about free host haha

any free hosting company which uses the vista control panel for free accounts is do not allow wap sites.

I dont think so u know about that

I'm not good but wanted to be clever 🙂

Nahar Developer · 196 posts #19

awan wrote: Host? Haha . Demo please . . If you mean . Vista panel host sorry im n0t intrested , lol . Like u say wht Stop Use FREE HOST bCoz Its CRAP!! N0w u offering me about free host haha

any free hosting company which uses the vista control panel for free accounts is do not allow wap sites.

I dont think so u know about that

LoL..Free Host Again?? i Have 3 Premium Shared Host n 1 VPS...my Shared Host Will Expire November 2011 i Said Its Free For u bCoz m Not Sell It For u..LoL Think b4 Post 😛

awan Junior · 28 posts #20

Nahar wrote: LoL..Free Host Again?? i Have 3 Premium Shared Host n 1 VPS...my Shared Host Will Expire November 2011 i Said Its Free For u bCoz m Not Sell It For u..LoL Think b4 Post :P

Do i care? Lalalala .

adex3g wrote: Why cant u learn base php lol, i found most dangerous hacking hole on your script awan

With part bro ? Can u tell me .

I'm not good but wanted to be clever 🙂

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close