O'Reilly logo

CouchDB and PHP Web Development Beginner's Guide by Tim Juravich

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action — altering .htaccess to support public files

We need to alter the .htaccess file, so that the request for the public files is not passed to the index.php file, but instead goes into to the public folder and finds the requested resource.

  1. Start by opening up the .htaccess file that's in the root of our project.
  2. Add the following highlighted code:
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^css/([^/]+) public/css/$1 [L]
    RewriteRule ^js/([^/]+) public/js/$1 [L]
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?request=$1 [QSA,L]
    </IfModule>
    
    

What just happened?

We just added RewriteRule to bypass our

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required