Search code examples
php.htaccessmod-rewritedocument-rootfat-free-framework

Fat-Free Framework mod rewrite doesn't work


I am trying to run a php project with Fat-Free Framework on MAMP, running on Yosemite 10.10.1. I have all the project files in MAMP web root folder "htdocs" and all the fatfree project files are located within a fatfree-master dir.

The specific dir location is : htdocs/libs/FatFreeFramework/fatfree-master

I have succesfully imported a database into phpmyadmin.The size of it was 2.5mb but no errors flashed during the upload so i assume the size was not a problem at all!

I set up a virtual host on apache & now the file httpd-vhosts.conf looks like this :

ServerName localhost

DocumentRoot “/Applications/MAMP/htdocs”

<Directory "/Applications/MAMP/htdocs">
    Options Indexes FollowSymLinks 
    AllowOverride All 
    Order allow,deny
    Allow from All
</Directory>

ErrorLog /Applications/MAMP/logs/error.log

CustomLog /Applications/MAMP/logs/access.log combined

Following these instructions to enable the mod rewrite on i edited the .htaccess file and now it looks like this :

RewriteEngine On

RewriteBase /libs/FatFreeFramework/fatfree-master/

RewriteCond %{REQUEST_FILENAME} !-l

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule .* /libs/FatFreeFramework/fatfree-master/index.php [L,QSA]

I modified the rewrite base to point to the /[dirname]/ and then change RewriteRule to /[dirname]/index.php

In the httpd.conf i edited the Directory to AllowOverride All but still i cannot get the project running on browser.

I noticed that there are 2 .htaccess files, one on the htdocs dir & another on fatfree-master dir!

Which one of them do i have to edit in order to enable the mod rewrite on the fatfree-framework?

Do i point correctly the path of the index.php?


Solution

  • Just use this .htaccess would be fine.

    RewriteEngine On
    RewriteCond %{REQUEST_URI} \.ini$
    RewriteRule \.ini$ - [R=404]
    RewriteCond %{REQUEST_FILENAME} !-l
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule .* index.php [L,QSA]
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]