Im trying to get mod rewrites to work. I have a .htaccess set in my root directory where my index.php document is at but its not working correctly. My .htaccess contains the following

RewriteEngine on
RewriteBase /
RewriteRule !.(js|ico|txt|gif|jpg|png|css)$ index.php

which enables all request to be forwarded to index.php. but when I type in an unknown page, instead of it going back to index.php, it says it cant find the page

Not Found

The requested URL /zend/index/test was not found on this server.

above is the error I get

Im trying to use the zend framework. and I got it to work for the index, but for any other actions im guessing its not going back to index again. can anyone help me

this is my first time making a htaccess so im not even sure if my php.ini is configure to read .htaccess files

    Heres the .htaccess file that i use for a similar function, perhaps it will be of some use.

    Addhandler application/x-httpd-php .html .php
    #Options +FollowSymLinks
    IndexIgnore
    # Turn on the RewriteEngine
    RewriteEngine On
    #  Rules
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . index.php

    For my purposes, it successfully rewrites all non existant URLs to the index.php file, and handles directories as well (i.e. '/example.php' and 'directory/example.php' both get rewritten to /index.php). It

    If a file DOES exist however, it'll ignore the rewrite, and loat the actual file itself.

      Here's my Zend Framework .htaccess file. Note that I have TinyMCE so I need to allow access to /scripts.

      RewriteEngine on
      RewriteRule !(^scripts\/|\.(js|ico|gif|jpg|jpeg|png|css)$) index.php

      Works perfectly fine. You can see it in action here. You can go to UMBC EHS Home, Undergrad to see content, but Graduate, Faculty & Staff, and Continuing Education are all blank (i.e. handled by my error controller).

      Well, ConEd actually takes you back to the index, but that will hopefully change tomorrow (hopefully I can finish it tomorrow).

        Yea those arent working. I dont think it has anything to do with my htaccess file. I think it has more to do with my php.ini not reading either my htaccess or something not being enable within it. I dont know why its working. the framework works perfectly only for index only. any other action it can not find. which leaves me to believe its something that needs to be set. Could htaccess be disabled ??

          PHP has nothing to do with .htaccess. So let's start from the top:

          1. Are you running Apache?

          2. Is the mod_rewrite module installed?

          3. Is mod_rewrite module enabled?

          If you can answer yes to all three questions, then we need to do some debugging 😉 Otherwise, we've found the problem.

            Nevermind, I had to set allowoveride to All instead of none

            and yes to all the above

              Write a Reply...