Hello,

I used a certain type of .htaccess that redirect all url to index.php

That doesn't work in zend studio though.

What's wrong?

    Define "doesn't work". As in you're doing the profiling or debugging of your scripts and requests don't get filtered through the .htaccess?

      If I go to http://localhost/somedirectory/index.php the program works

      If I go to http://localhost/somedirectory/whatever/something.htm I got a 404 error saying that there is no such file.

      It's true that there is no such file. However, I have a .htaccess files there

      BEGIN WordPress

      <IfModule mod_rewrite.c>
      RewriteEngine On
      RewriteBase /
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule . /index.php [L]
      </IfModule>

      END WordPress

        So you only want to catch those requests that aren't valid files or directories? I would venture a guess as to say you might need to remove the RewriteBase from it.

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

          Still doesn't work.

          My .htaccess is now like this

          BEGIN WordPress

          <IfModule mod_rewrite.c>
          RewriteEngine On

          RewriteCond %{REQUEST_FILENAME} !-f
          RewriteCond %{REQUEST_FILENAME} !-d
          RewriteRule . /index.php [L]
          </IfModule>

          END WordPress

            Still doesn't work.

            My .htaccess is now like this

            BEGIN WordPress

            <IfModule mod_rewrite.c>
            RewriteEngine On

            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteRule . /index.php [L]
            </IfModule>

            END WordPress

              I think the easiest way to do this (especially since you may not have access to the apache config files, just .htaccess) is to use the Files directive and ForceType

              <Files articles>
              ForceType application/x-httpd-php
              </Files>

              http://domainname.com/articles/whatever will just be parsed (same page) as http://domainname.com/articles.

              If you have access to the apache config files, I believe you can use the Location directive to stipulate the virtual root...

              I suppose I should point out that you have to have a file called "articles" in the example with the Files directive. Zend Studio can be configured to read a no extension file as a PHP file. Also, you can create an articles.php file (for updating/writing) and then just create a sym link like...

              $ ln -s articles.php articles

              Also, I dunno what type of Apache server Zend Studio implements. I can't debug in the browser unless I use remote debugging. What are you using?

                Also, I dunno what type of Apache server Zend Studio implements.

                It uses whatever Apache you want (you can install it, or you can have Zend install it).

                I honestly don't know. I have a linux box with Apache 2.2.x installed, and have this in my .htaccess and it works perfectly fine (as expected):

                RewriteEngine On
                
                RewriteCond %{REQUEST_FILENAME} !-f
                RewriteCond %{REQUEST_FILENAME} !-d
                RewriteRule ^.*$ index.php?404 [L]

                I'm going to guess you also posted this at Wordpress, as when I searched for things, that came up as well (see: RewriteCond %{REQUEST_FILENAME}).

                  Write a Reply...