1

This is the .htaccess Zend Framework 1 manual suggests to use:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

I intend to publish the website into a subfolder, like so: http://localhost/my-app/ So the way to go would be to add this line to the file:

RewriteBase /my-app

Now everything works.

The problem is the subfolder name will vary (and may even be empty -> http://my-app.com/), and I would like to have a .htaccess file that works in every situation because I have an automated deployment procedure.

So is there a solution for the rewriting to work without specifying RewriteBase?


Edit: Directory structure

my-app/
    application/
    library/
    public/
        .htaccess
        index.php
        ...
    tests/
4

1 回答 1

0

公众.htaccess不应该RewriteBase

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} -s [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ index.php [NC,L]
</IfModule>
于 2013-04-11T08:35:27.667 回答