Archive

Posts Tagged ‘header’

How To View E-Mail Headers In Outlook 2007

August 29th, 2008

While it’s a bit hidden, you can still view the Message Headers for any mail you receive in Outlook 2007. And there are 2 ways to view them, too. Read more…

Matti Windows , , ,

There Are HTTP Headers, And Then There Are HTTP Headers

August 28th, 2008

Sounds confusing? No worries, it’s really not. Here are some standard HTTP headers from a random website.

[root@vps ~]# curl --head http://www.mattiasgeniar.be
HTTP/1.1 200 OK
Date: Thu, 28 Aug 2008 17:58:15 GMT
Server: Apache/2.2.3 (CentOS)
X-Powered-By: PHP/5.1.6
X-Pingback: http://www.mattiasgeniar.be/xmlrpc.php
Set-Cookie: PHPSESSID=sudpae35dbuesipfiouipcbue0; path=/
Connection: close
Content-Type: text/html; charset=UTF-8

Nothing special about it, perhaps the X-Pingback is a bit odd – it’s added by wordpress to allowed automatic pingbacks to certain articles. You have your typical date, server, connection & content-type shown to you.

Some sites however … like to add some special things. Slashdot for instance adds a new Futurama quote with every page you load. It’s hidden to 99,9% of the users out there – only the geeks who actually look at the headers will see this.

[root@vps ~]# curl --head http://slashdot.org          
HTTP/1.1 200 OK
Date: Thu, 28 Aug 2008 18:02:27 GMT
Server: Apache/1.3.41 (Unix) mod_perl/1.31-rc4
SLASH_LOG_DATA: shtml
X-Powered-By: Slash 2.005001217
X-Bender: They're tormenting me with uptempo singing and dancing!
Cache-Control: private
Pragma: private
Connection: close
Content-Type: text/html; charset=iso-8859-1

Note the X-Bender: They’re tormenting me with uptempo singing and dancing! quote in there! You’ll also find quotes by Leela & Fry.

  • X-Bender: I only know enough binary to ask where the bathroom is.
  • X-Bender: Gimme your biggest, strongest, cheapest drink.
  • X-Leela: This is by a wide margin the least likely thing that has ever happened.
  • X-Leela: This toads the wet sprocket.
  • X-Fry: You mean Bender is the evil Bender? I’m shocked! Shocked! Well not that shocked.
  • X-Fry: I must be a robot. Why else would human women refuse to date me?

It’s probably been known for a while, but it was knew to me. Kinda cool – now I’m looking at ways to add fancy headers for this server as well … :-) You can read more about it on this Fun With HTTP Headers article!

Edit: turns out it is incredibly easy to add a custom http header to apache. Just enable the use of .htaccess and you can add all the headers you like. Add the following line, to create a “X-Who-Rocks”-header!

Header set X-Who-Rocks "Mattias Geniar"

This is what the headers for this site now look like! Muchos better! :-)

[root@vps httpdocs]# curl --head http://www.mattiasgeniar.be
HTTP/1.1 200 OK
Date: Thu, 28 Aug 2008 18:23:48 GMT
Server: Apache/2.2.3 (CentOS)
X-Powered-By: PHP/5.1.6
X-Pingback: http://www.mattiasgeniar.be/xmlrpc.php
Set-Cookie: PHPSESSID=ibmsf43qjjnkc6h6fudfok0sp5; path=/
X-Who-Rocks: Mattias Geniar
Connection: close
Content-Type: text/html; charset=UTF-8

Yarrr!

Matti Humor, Security , ,

Using Proper Header Redirects In PHP

July 30th, 2008

Let’s say you have an old web-page that’s no longer in use. Of course, you’ll want to redirect your users to the correct (new) page. Using PHP, you can modify the headers of a web-page to redirect them to the correct page.

< ?php
header("Location: http://www.mydomain.com/newpage.html");
exit();
?>

This will cause the user who visits the web page with this code, to be redirected to http://www.mydomain.com/newpage.html (or any other page you specify).

That’s all fine, and works well. But what if Google indexed your old web page, and still directs traffic to it? What if search-results in Google only display the old page, instead of the new one? What if, one day, you decide to take the old page offline? Read more…

Matti PHP, Seo , , ,