How to remove the .php extension using htaccess

Posted on Tuesday 10 February 2009

A .htaccess file is a file located at your webserver which enables you to make changes to some of the Apache options without having to modify the httpd.conf Apache configuration file or restarting the webserver. Making changes in the httpd.conf file requires a reboot of the webserver. Most webservers allow htaccess modifictations to a certain extend. The only disadvantage of using a htaccess is, every time a http request is made, it has to read the htaccess file, resulting in a slower delivery time.

This is the htaccess file I use to remove the .php extension to create clean urls. All you have to do is create a .htaccess file. Unless hidden files are visible on your hard drive you shouldn‘t name it .htaccess at first, but rename it when you‘ve uploaded it to your web space, because all files beginning with a dot become automatically hidden. So, just leave out the dot at first.

RewriteEngine On

RewriteBase /

RewriteRule ^()$ index.php [NC,L]

RewriteCond % !(^/?.*..*$) [NC]

RewriteRule (.*)$ $1.php [NC]

Read more →

Path Finder

Posted on Saturday 7 February 2009

This program is what the Finder on Mac should be like. I just downloaded it yesterday, so I haven‘t really had the time to fully test this application, but it looks promising. Tabbed navigation is a major plus. And the path navigator, which you see on top, is a big help. I‘ve explained in another post, how to display the full path in your Finder. Path Finder also has a Quicksilver-like application. The downside is, the focus has to be on path finder to start the launcher. I hope they‘ll change this in another release. Path Finder also allows split window view. Another cool feature is the drop stack which enables you to drag files in the drop stack, go to the desired folder en dan drag and drop the files there. Normally on Mac, when you press return on a file you can rename it. With path Finder, only the return on the numpad is used to rename files. The other return button opens the file with the associated program. It takes a bit of getting used to, but in the end it‘s a logical way of working.

Read more →

Image resizing on the fly using PHP

Posted on Friday 6 February 2009

Smart Image Resizer 1.4.1

this is one of the best PHP scripts I‘ve found so far on the internet. It‘s made under the Creative Commons license. All he asks is to include a link on your website to his website when you use his script http://shiftingpixel.com. It allows you to crop or scale an image on the fly only by setting a certain width, height and if necessary a cropratio. If you, for example, change the layout of your website and the images need to be larger, you don‘t need to scale the images all over again. Just change the parameters and the images will be cropped to that size. The original images aren‘t modified in the process. I‘ve incorporated this script in the CMS from webFizz and saved me a lot of time so far. 

Read more →

terminal tips for Finder

Posted on Friday 6 February 2009

Enable path view in Finder: 

 

Because I use so many folders and files, I often find myself lost in my hard drive. To enable the pathview in the Finder just type this in the terminal: 

defaults write com.apple.finder _FXShowPosixPathInTitle -bool YES 

after doing this you need to restart your Finder. Do this by typing in: 

killall Finder

(mind the capital F)

to disable this, just replace the YES by NO.

Read more →

filter_var() input validation by PHP

Posted on Friday 6 February 2009

I recently discovered a very useful function in PHP. It‘s called filter_var(). It takes three arguments: a variable and the filter and a last optional argument, the options. The last argument uses an associative array of flags/options or a single flag/option. 

filter_var(variable, filter, options);

I use it in addition to javascript validation. That way when javascript is disabled your web-application is still secure and no unwanted data enters your precious database. I mainly use the filters :

FILTER_SANITIZE_NUMBER_INT

 FILTER_SANITIZE_STRING

FILTER_SANITIZE_EMAIL

FILTER_VALIDATE_EMAIL

FILTER_VALIDATE_INT.

Read more →

filter_var() input validation by PHP

Posted on Friday 6 February 2009

I recently discovered a very useful function in PHP. It‘s called filter_var(). It takes three arguments: a variable and the filter and a last optional argument, the options. The last argument uses an associative array of flags/options or a single flag/option. 

filter_var(variable, filter, options);

I use it in addition to javascript validation. That way when javascript is disabled your web-application is still secure and no unwanted data enters your precious database. I mainly use the filters :

FILTER_SANITIZE_NUMBER_INT

 FILTER_SANITIZE_STRING

FILTER_SANITIZE_EMAIL

FILTER_VALIDATE_EMAIL

FILTER_VALIDATE_INT.

Read more →