November 3, 2015

apache .htaccess pass URI to PHP

1. enable mod_rewrite : a2enmod rewrite
2. enable .htaccess by adding the following to the enabled site conf file:
        <Directory "/var/www/html">
        AllowOverride All
        </Directory>


 3. Create  .htaccess at /var/www/html with the following content
  Options +FollowSymLinks
  RewriteEngine On

  RewriteCond %{SCRIPT_FILENAME} !-d
  RewriteCond %{SCRIPT_FILENAME} !-f

  RewriteRule ^.*$ ./index.php

No comments:

Post a Comment