apache

Nice CSS tab menu with PHP

Thursday, March 1st, 2007

<?php
if (isset($_REQUEST[’tab’])) {
        $tab = $_REQUEST[’tab’];
    } else {
        $tab = 0;
    }
?>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″ />
<title>Controling CSS Tabs Using PHP</title>
<style type=”text/css”>
/*Credits: Vijit Patil */
.tabZ{
padding: 3px 0;
margin-left: 0;
font: bold 12px Trebuchet MS ;
text-align: left;
border-bottom: 1px solid gray;
list-style-type: none;
}
.tabZ li{
display: [...]

Apache rewrite rules for hosting multiple domains

Friday, February 24th, 2006

RewriteCond %{HTTP_HOST}  site1.com$ [NC]
RewriteCond %{REQUEST_URI} !^/vhosts/site1/.*$
RewriteRule ^(.*)$  /vhosts/site1/$1 [L]
RewriteCond %{HTTP_HOST}  site2.com$ [NC]
RewriteCond %{REQUEST_URI} !^/vhosts/site2/.*$
RewriteRule ^(.*)$  /vhosts/site2/$1 [L]

TechRepublic has more.

Blocking certain sites from hotlinking images via mod_rewrite

Saturday, February 18th, 2006

RewriteEngine On
RewriteCond %{HTTP_REFERER} ^http://(www\.)?badsite1\.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?badsite2\.com/ [NC]
RewriteRule \.(jpe?g|gif|png)$ images/no_hotlink.jpg [L]

Displaying another image when someone hotlinks

Saturday, February 18th, 2006

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mysite\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteRule \.(jpe?g|gif|png)$ images/no_hotlink.jpg [L]

Preventing hotlinking images from any domain except Yahoo! Image Search and Google Images

Saturday, February 18th, 2006

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://(images\.)?yahoo\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^http://(images\.)?google\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteRule \.(jpe?g|gif|png)$ - [F]

Keep on coding