Vincent Wong

废柴同盟 2.0

  • Home
  • Gallery
  • About Me
  • Contact
  • WPG2

Howto: Disable mod_security in .htaccess file

Catagory: Internet Security, linux


This quite common that mod_security is interfering the functions of your web applications. mod_security is installed and enabled by your web server admin but you can still disable it for your individual website using .htaccess file by following this tutorial.

Disable mod_security in .htaccess file

If you do not have one yet, an .htaccess file in the folder of your web application

To disable mod_security COMPLETELY, add the following line to the .htaccess file:

SecFilterEngine Off

OR, to disable HTTP POST scanning only, use the following instead:

SecFilterScanPOST Off

Save the file and test your web application to check whether disabling mod_security has solved your problem.

You should consider to try SecFilterScanPOST Off first, instead of disabling mod_security completely.

No Comments

.htaccess tips and tricks (Part2)

Catagory: linux

To perform a redirect from domain.com to www.domain.com, insert the following code into your .htaccess file.
# mod_rewrite in use
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{http_host} ^domain.com [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]

To perform a redirect from www site to non-www site, use the following code in .htaccess file.
# mod_rewrite in use
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^domain\.com
RewriteRule (.*) http://domain.com/$1 [R=301, L]

The .htaccess file is simply a text file with the filename .htaccess, and it should be stored at the root directory of your site.

Note, while using .htaccess file, it is important to use it carefully. Wrongly inserted command may render your site not workable.

No Comments

.htaccess tips and tricks

Catagory: Techs


One of the more powerful tricks of the .htaccess hacker is the ability to rewrite URLs. This enables us to do some mighty manipulations on our links; useful stuff like transforming very long URL’s into short, cute URLs, transforming dynamic ?generated=page&URL’s into /friendly/flat/links, redirect missing pages, preventing hot-linking, performing automatic language translation, and much, much more.

Whenever you use mod_rewrite (the part of apache that does all this magic), you need to do:
you only need to do this once per .htaccess file:
Options +FollowSymlinks
RewriteEngine on

..before any ReWrite rules. note: +FollowSymLinks must be enabled for any rules to work, this is a security requirement of the rewrite engine. Normally it’s enabled in the root and you shouldn’t have to add it, but it doesn’t hurt to do so, and I’ll insert it into all the examples on this page, just in case*.

Simple Rewritting

Simply put, Apache scans all incoming URL requests, checks for matches in our .htaccess file and rewrites those matching URLs to whatever we specify. something like this..

All requests to whatever.htm will be sent to whatever.php
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)\.htm$ $1.php [nc]

This will do a “real” http redirection:
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.+)\.htm$ http://corz.org/$1.php [r=301,nc]

This time we instruct mod_rewrite to send a proper HTTP “permanently moved” redirection, aka; “301″. Now, instead of just redirecting on-the-fly, the user’s browser is physically redirected to a new URL, and whatever.php appears in their browser’s address bar, and search engines and other spidering entities will automatically update their links to the .php versions; everyone wins. and you can take your time with the updating, too.

a more complex rewrite rule:
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^files/(.+)/(.+).zip download.php?section=$1&file=$2 [nc]

would allow you to present a link as..
http://mysite/files/games/hoopy.zip
and in the background have that translated to..
http://mysite/download.php?section=games&file=hoopy

shortening URLs
One common use of mod_rewrite is to shorten URL’s. shorter URL’s are easier to remember and, of course, easier to type. an example..

beware the regular expression:
Options +FollowSymlinks
RewriteEngine On
RewriteRule ^grab(.*) /public/files/download/download.php$1

this rule would transform this user’s URL..
http://mysite/grab?file=my.zip
server-side, into..
http://mysite/public/files/download/download.php?file=my.zip

No Comments

NTP - update your linux time

Catagory: linux

Using NTP (Network Time Protocol)

NTP will connect to a server to get the atomic time. It can be downloaded from www.ntp.org/downloads.html To get started with NTP simply download it, install it, use the ntpdate command followed by a public time server, and update your hardware clock.

$ntpdate pool.ntp.org
23 Feb 22:43:53 ntpdate[21751]: step time server 202.133.102.90 offset 61.642505 sec

$ hwclock --systohcntpdate pool.ntp.org

No Comments

性格是命、 职业是运(part-2)

Catagory: BullShit

什么样的职业最适合你?
世界上最大的悲剧莫过于有太多的年轻人从来没有发现自己真正想做什么。你在这个世界上将找到什么样的工作?你的工作将是什么?从根本上说,这不是一个关于干什么事和得什么报酬的问题,而是一个关于生命的问题。工作就要付出努力。正是为了成就什么或获得什么,我们才要专注于什么,并在那个方面付出精力。

薪水不应当是选择工作时考虑的首要元素,更不能 是惟一的因素。因为金钱不是一个人一生的终极目标;获得金钱也不是一个人事业的顶峰,只是所有事业中的一小部分而已。

世界上最大的悲剧莫过于有太多的年轻人从来没有发现自己真正想做什么。
想想看,一个人在工作中只能赚到薪水,其他的一无所获,这是一件多么可悲的事情啊!许多年轻人不了解自己能够做什么,也不知道自己真正想做什么。

了而立之年却依然一事无成就变得沮丧、颓废,甚至麻木不仁起来。
还有的人仅仅把命定的职业看做是谋生的手段。生活本来可以更壮丽辉煌,人本来可以成为顶天立地的男子汉。带着上天赋予我们的种种才能,我们本来可以使生活更充实,使人生更完满,然而,仅仅为了谋生而工作的做法却使我们变得卑微和庸俗。

国作家辛克莱在耶鲁大学念大四的时候,他对名教授羌赛·丁格说:“我这一生最想做的工作是写作。”
教授对他说:“那你会饿肚子啊!”
辛克莱说:“只要我能写作,我不管肚子饿不饿!”
教授说:“哦,那你会成功!”

其实,世界上的事情往往就是这样,当你说“我就是要做这件事,多困难我都不在乎”时,上帝就会开始支持你。

No Comments

性格是命、 职业是运 (part-1)

Catagory: BullShit

你特别的聪明才智就藏在你自己的性格里,而真正适合你的职业应当能够表现你的个性与天赋。如果你找到了适合自己的位置,工作本身就会充分而全面地调动你的才能。千万不要做你不擅长的事情,如果你做了,你会发现自己就像深陷于泥潭之中,只能徒劳地挣扎、抱怨。

“职业没有最好的,只有最合适的。”

“好的首先是合适的。”

很多人认为投身热门的职业或行业就意味着自己前途似锦,不可限量。这实际上是不对的,因为某一职 业、行业有着光明的前景,是热门职业,是朝阳产业,并不等于这职业或行业中的每一个人都有前途。如果你的性格不适合这一职业或岗位,你就不可能成功。

人很容易在人行三到五年后产生“疲态”。就像800米赛跑,前面一圈还可咬着牙紧迫,后面一圈“看看实在是与第一名差距太大”,他们的内心便开始打架、犹豫、彷徨,最终自己就停下了前行的脚步。

工作中,如果你不能以最高水准来完成你的工作,那么请检查一下——你所努力从事的职业本身是否真的适合你的天性,或者看这一T作是否真是你获得成功英国的蒲伯作为一名律师是失败的。他非常胆小,甚至完全没有勇气为一个案件进行辩护。但是,他却给我们写下了一些脍炙人口的诗歌。莫里哀也发现自己不适合做一名律师,但是,他在文学领域里却美名远扬。伏尔泰和彼特拉克最终都放弃了法律,前者选择了哲学,后者选择了诗歌。

如果所从事的职业与自己的性格不符,那他注定碌碌无为。成功的人之所以成功,就在于他们寻找到了适合自己性格的职业。而每一位失败的人,都是因为他们还没有为自己找寻到合适的职业。

No Comments
Total Pages:9First Post<Next Post>Last Post
July 2008
M T W T F S S
« Apr    
 123456
78910111213
14151617181920
21222324252627
28293031  

Recent Comments

  • Vincent in Check Your Hotmail, Yahoo Mail with…
  • Douglas in 有自卑感这样的东西吗?
  • admin in Howto: Linux compress / decompress …
  • lhseong in Howto: Linux compress / decompress …
  • admin in 一道受用终身的测试题 (par…
  • kww in 一道受用终身的测试题 (par…
  • stingfish in 一道受用终身的测试题 (par…
  • -@_@- in 一道受用终身的测试题 (par…
  • admin in Debut
  • karwan in Genting with Francis

Archives

  • July 2008
  • April 2008
  • March 2008
  • February 2008
  • January 2008
  • December 2007
  • November 2007
  • October 2007
  • September 2007
  • August 2007

Recent Entries

  • Howto: Disable mod_security in .htaccess file
  • .htaccess tips and tricks (Part2)
  • .htaccess tips and tricks
  • NTP - update your linux time
  • 性格是命、 职业是运(part-2)
  • 性格是命、 职业是运 (part-1)
  • 等人求助不如向人討教
  • 不要跟著一大群人遞出名片
  • 不怕出醜才能牢記禮節
  • 擔心受傷害必將無法建立友誼

Tags

一道受用终身的测试题 人際關係 你是胡萝卜,是鸡蛋,还是咖啡豆 公司 冒风险 外人 失败了再爬起来 打招呼 知己知彼,百战不殆 聪明 致禮 .htaccess apache backtrack2 Carrot coffee egg ego gz.tar hide IP Platinum high scalability Hotmail Howto: Hide your IP address when browsing Howto: Linux compress / decompress files with Tar Howto: Monitor linux cpu usage install know your enermy in order to win links lose and win mod_rewrite redirection RewriteEngine risk taker self-contempt seo server-status switchproxy tool tips tor tricks vmware website scale windows Yahoo zip

Categories

  • BullShit
  • Internet Security
  • linux
  • Music
  • Photo Blog
  • Techs

Pages

  • About Me
  • Contact
  • WPG2

Blogroll

  • “好时光 l GoodTime” - Douglas Ho’s Blog & Gallery
  • BlogSecurity - Web blog Security
  • Myviclub.com - Perodua Myvi Owner’s Club Malaysia
  • Vincent’s Gallery - Gallery Page

Meta

  • Register
  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org
©2008 Vincent Wong
Talian designed by VA4Business, Virtual Assistance for Business who's blog can be found at Steve Arun's Virtual Marketing Blog | Brought by Wordpress Themes