Search code examples
phpapache.htaccessxamppfat-free-framework

How to setup F3 with XAMPP locally?


I am trying to run a Fat Free PHP project locally with XAMPP from C:\xampp\htdocs\abc My problem is none of my css, images, or links work. I added an .htaccess file:

RewriteEngine On
RewriteBase /abc/
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* /abc/index.php [L,QSA]

It seems to have helped somewhat in that my index.php loads but none of the css nor images load. Also, when I click any links I get 404s, and the url does not route to my /abc directory.

I have tried countless RewriteRules and RewriteConds with no luck.

Also, everything works fine in production so I would like to not change the structure.

Any help on the would be greatly appreciated, thanks.


Solution

  • Try with this .htaccess:

    RewriteEngine On
    RewriteBase /abc/
    
    # skip all files and directories from rewrite rules below
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    
    RewriteRule (.+\.(?:gif|png|jpe?g|css))$ /abc/$1 [NC,L]
    RewriteRule .* /abc/index.php [L]