Disable Directory Listing Without Slash – Apache Config

Sometimes you need to deny directory listing on user input. For example, you don’t want your blog to be accessed at http://yoursite.com/blog, using only http://yoursite.com/blog/. This slash is added by mod_dir, that allows automatic adding of trailing slashes. A “trailing slash” redirect is issued when the server receives a request for a URL http://servername/foo/dirname where dirname is a… Read More »

Disable Apache Logging in httpd.conf – How to Do It

On busy servers you might need to take off everything that is not used. If Apache logs are neither watched nor analyzed, you should simply turn them off. How to do it? Simply, as usual: open httpd.conf and unload #LoadModule log_config_module modules/mod_log_config.so by commenting this line. You should also search for various log strings that should be found… Read More »

Encoding ASCII Characters in URL – PHP Solution

Sometimes you need to encode the whole URL, not just specific characters that are encoded with urlencode(). You might need to represent your query string or anything else as shown at W3C School. There is quite a simple solution in PHP: <? $string=”some-string”; for ($i=0; $i<strlen($url); $i++) { $mass[$i]=”%”.dechex(ord($url{$i})); } $encoded_string=implode(“”, $mass); ?> In the sample provided the… Read More »