doingword.com

Archive for November, 2007

How to get the extention of the file with php with strrchr function

Saturday, November 10th, 2007

Hi guys,
With this code you can get the extension of a file. This is very simple and useful.

  1. $ext = strrchr($file,".");

If the value of $file is “/files/games/mathattach.swf” the value of $ext will be “.swf”;

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Posted in Php, tip | No Comments »

How to make a permanent reditect with php headers

Saturday, November 10th, 2007

Hi guys!
With this script you can make a permanent 302 redirection with php headers. This is very usefull when you want to make that google think that your domain.com is the same that www.domain.com.
Here the script:

if ($_SERVER[”HTTP_HOST”] == “www.domain.com”)
  1. {
  2. Header( "HTTP/1.1 301 Moved Permanently" );
  3. Header( "Location: http://domain.com".$_SERVER["REQUEST_URI"]);
  4. }

It’s very simple, but very usefull.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Posted in Php, SEO, tip | No Comments »