0

The Document folders are structured like this

/var/wwww/ (root)
    java/
    ...
    php/
        projectone/
            controller/
            view/
                index.php
            ...
        projecttwo/
            ...

I want all requests to /php/projectone or it's subfolders to redirect to /php/projectone/view/index.php, while requests to /php/projecttwo and other folders should not be redirected.

I believe using mod_rewrite is the way, however, I still haven't achieved what I want.

4

1 回答 1

1

.htaccess使用以下规则放置一个内部项目一个文件夹:

Options +FollowSymLinks -MultiViews

RewriteEngine On
RewriteBase /php/projectone/

RewriteRule ^(view/)?index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . view/index.php [L]

您可以对您拥有的任何其他项目文件夹重复此操作。通过改变RewriteBase.

于 2013-09-07T18:55:32.083 回答