Home » Archive

Articles Archive for April 2008

Code »

[16 Apr 2008 | No Comment | ]

<?php
$to = “someone@example.com”; $subject = “Test mail”; $message = “Hello! This is a simple email message.”; $from = “someonelse@example.com”; $headers = “From: $from”; mail($to,$subject,$message,$headers); echo “Mail Sent.”;
?>

Code, Computing »

[15 Apr 2008 | No Comment | ]

RewriteEngine On RewriteCond %{HTTP_HOST} !^(.*)\.duivesteyn\.com\.au$ [NC] RewriteRule ^(.*)$ http://www.duivesteyn.com.au/$1 [R=301,L]

Code »

[12 Apr 2008 | No Comment | ]

redirect 301 /old/old.htm http://www.you.com/new.htm
 
It’s as easy as that. Save the file, upload it back into your web and test it out by typing in the old address to the page you’ve changed. You should be instantly and seamlessly transported to the new location.

Code »

[12 Apr 2008 | No Comment | ]

 
 

Sometimes, you might want to get the current page URL that is shown in the browser URL window. For example if you want to let your visitors submit a blog post to Digg you need to get that same exact URL. There are plenty of other reasons as well. Here is how you can do that.
Add the following code to a page:
<?php
function curPageURL() {
$pageURL = ‘http’;
if ($_SERVER["HTTPS"] == “on”) {$pageURL .= “s”;}
$pageURL .= “://”;
if ($_SERVER["SERVER_PORT"] != “80″) {
$pageURL .= $_SERVER["SERVER_NAME"].”:”.$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}
?>