title: apache mod_rewrite is not working or not enabled
body: <p>I have installed rewrite_module and modified <code>php.ini</code> on Apache.</p>
  
  <p>I create <code>rewrite.php</code> and <code>.htaccess</code> files, but it's not working.</p>
  
  <h1>My filesystem folders like:</h1>
  
  <pre><code>/var/www/html
  /var/www/html/test
  /var/www/html/test/.htaccess
  /var/www/html/test/rewrite.php
  </code></pre>
  
  <h1>/var/www/html/.htaccess content is:</h1>
  
  <pre><code>$ cat /var/www/html/test/.htaccess 
  
  RewriteEngine On 
  RewriteRule ^link([^/]*).html$ rewrite.php?link=$1 [L]
  </code></pre>
  
  <h1>/var/www/html/rewrite.php</h1>
  
  <pre><code>$ cat /var/www/html/test/rewrite.php 
  
  &lt;html&gt;
  &lt;h2 align=center&gt; 
  &lt;?php 
  // mod_rewrite Test Page 
  // Copyright 2006 Webune.com 
  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";} 
  ?&gt; 
  &lt;/h2&gt; 
  &lt;hr&gt; 
  &lt;head&gt; 
  &lt;title&gt;How To Test mod_rewrite in Apache Linux Server&lt;/title&gt; 
  &lt;/head&gt; 
  &lt;body&gt; 
  &lt;p align="center"&gt;by &lt;a href="http://www.webune.com"&gt;Webune&lt;/a&gt;&lt;/p&gt; 
  &lt;p&gt;&lt;a href="rewrite.php?link=1"&gt;LINK1&lt;/a&gt; = rewrite.php?link=1&lt;/p&gt;
  &lt;p&gt;&lt;a href="link2.html"&gt;LINK2&lt;/a&gt; = link2.html&lt;/p&gt; 
  &lt;p&gt;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&lt;/p&gt; 
  &lt;p&gt;&amp;lt;&amp;lt; &lt;a href="http://www.webune.com/forums/viewtopic-p-62.html"&gt;Go back to webune forums.&lt;/a&gt;&lt;/p&gt; 
  &lt;/body&gt; 
  &lt;/html&gt;
  </code></pre>
  
  <h1>mod_rewrite.so is installed.</h1>
  
  <pre><code>$ ls -l mod_rewrite.so
  -rwxr-xr-x 1 root root 59256 Sep 20 23:34 mod_rewrite.so
  </code></pre>
  
  <h1>rewrite_module is loaded.</h1>
  
  <pre><code>$ cat /etc/httpd/conf/httpd.conf | grep mod_rewrite.so
  LoadModule rewrite_module modules/mod_rewrite.so
  </code></pre>
  
  <h1>AllowOverride setting</h1>
  
  <pre><code>$ cat /etc/httpd/conf/httpd.conf
  &lt;Directory "/var/www/html"&gt;
      Options Indexes FollowSymLinks
  
      AllowOverride None
  
      Order allow,deny
      Allow from all
  &lt;/Directory&gt;
  </code></pre>