Archive

Archive for the ‘Web Development’ Category

Delete .svn folders recursively using command line

October 5th, 2009

some times i work on small projects with friends and we use Subversion to track and store code changes, collaborate, and share project files so once we finish we usually upload it somewhere by copying the whole project folder so i face that subversion makes folder inside each folder in the project called “.svn” and that take time to remove manually and unnecessary size to upload
so i run a command inside the project folder to remove that folders recursively before upload.

Run this:

find . -name .svn -exec rm -rf {} \;

Khalil Majdalawi Linux, Web Development , ,

How to get client MAC address in PHP

July 4th, 2009
<?php
exec('arp '.$_SERVER['REMOTE_ADDR'],$user_mac);
echo substr($user_mac[1],strpos($user_mac[1],':')-2, '17');
?>

Note : this technique only works on local area networks with linux based server and its impossible to get mac address in php over internet

Khalil Majdalawi Internet, Linux, PHP, Web Development

RIP IE6 for god’s sake

May 28th, 2009

ripie6-2

if i hate Microsoft , IE6 will be the reason not BSOD not security not stability , “IE6” i wish it vanish for good

ripie6-3

RIPIE6 to donate for memorial service

Khalil Majdalawi Internet, Technology, Web Development , ,

Remove or force www from domain name

May 21st, 2009

its very simple SEO trick to avoid duplicate content on Google search engine and increase your rank , you have to chose which one suit you www or non-www

first you have to enable “rewrite mod” which is apache server feature click here

then use the following lines in your .htaccess file
to remove WWW

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

to force WWW

RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]

Please, note that the .htaccess should be located in the web site main folder.

for farther reading about .htaccess Check this great post

Khalil Majdalawi Web Development

Enable Mod rewrite in apache

May 21st, 2009

For Debian use

sudo a2enmod rewrite

For Windows

  1. Find the httpd.conf file (usually you will find it in a folder called conf, config or something along those lines)
  2. Inside the httpd.conf file uncomment the line LoadModule rewrite_module modules/mod_rewrite.so
  3. Also find the line ClearModuleList is uncommented then find and make sure that the line AddModule mod_rewrite.c is not commented out.

restart your apache service and you are cool to go

Khalil Majdalawi Internet, Linux, Web Development, windows