使用.htaccess将所有目录请求重写到子目录

I am trying to rewrite all requests made to /myproj(or any files inside it) to /myproj/web using .htaccess.

The problem I am having is that the requests with a trailing slash (e.g., /myproj/somefile.php/) are somehow being rewritten to /docroot/index.php instead of /myproj/web/somefile.php/.

My /myproj/.htaccess file:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^(.*)$ /myproj/web/$1 [QSA,L]
</IfModule>

Take a look at this answer. It is the same problem I had, answered by a dear peer over at stackoverflow.