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 — creating the .htaccess file

In order for us to handle all requests to a directory, we'll create a .htaccess file in the working directory.

  1. Create a file called .htaccess in the working directory.
  2. Add the following code to the file:
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?request=$1 [QSA,L]
    </IfModule>
    
  3. Open the file index.php in the working directory.
  4. Change the code inside of index.php to match the following:
    <?php echo $_GET['request']; ?>
    
  5. Open your browser, go to http://localhost/verge/test/abc, and go to http://localhost/verge/test/123. Notice that the page will respond back to you with the same value that you entered at the ...

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