Rewrite apache test

1. Create a php file called “rewrite.php” containing the following code


<h2 align=center>

<?
if($_GET[‘link’]==1){echo"You are not using mod_rewrite";}
elseif($_GET[‘link’]==2){echo"Congratulations!! You are using Apache mod_rewrite";}
else{echo"Linux Apache mod_rewrte Test Tutorial";}
?>
</h2>
<hr>
<head>
<title>How To Test mod_rewrite in Apache Linux Server</title>
</head>
<body>
<p><a href="rewrite.php?link=1">LINK1</a> = rewrite.php?link=1</p>
<p><a href="link2.html">LINK2</a> = link2.html</p>
<p>How this works: both links are for this same page, except they both are different. link one is without the mod_rewrite and link2 is using mod_rewrite. Link1 show the php file, with with mod_rewrite we are mascarading the php file into a html file. you can use whatever type of extension you want, you can change it to .htm or .shtml etc… all you have to do is to make sure you also chang it in the .htaccess file</p>
</body>
</html>

2. Create a .htaccess file with these lines.


RewriteEngine On
RewriteRule ^link([^/]*).html$ rewrite.php?link=$1 [L]

3. Place both files in the same directory somewhere in the www root.
4. Open rewrite.php in your browser.
Now click on LINK2 and the same page will display with the a mod_rewrite message. If it doesnt you either did something wrong. Check your steps. If you checked your steps, refresh your browser, and if refreshing doesnt work, then you dont have mod_rewrite enabled.

Note: apache2 on ubuntu also requires you to edit the ‘default’ site as well in order to make rewrite possible (AllowOverride None -> All)

Php module extensions loading problem

Sometimes you want to try new things, so i decided to get a web-mail typ of thing running. By doing so i had to put my head into php again (more into ruby nowadays). But anyway i needed some modules to get loaded. No problem i figured… checked everything, made the adjustments.. but no voila 🙁 . Although i was sure path setting were ok, it still did not work. After searching the web for a while i ran into the following . The person Anon mentioned something about checking the dll’s you’re trying to load with a program called depends.exe …. and among all the rubbish found during the search, this on worked…Thanx man 🙂