.htaccess 使用mod_重写到DocumentRoot之外的资源

.htaccess 使用mod_重写到DocumentRoot之外的资源,.htaccess,mod-rewrite,apache2,.htaccess,Mod Rewrite,Apache2,我有一个我认为非常简单和经典的mod_rewrite用例,这让我很困惑 我的文件结构如下: /var/www/site /var/www/site/webapp <-- js application /var/www/site/index.php <-- php entry point /var/www/site/.. other folders.. 所需的功能是: http://site.dev/从/webapp加载内容 http://site.dev/ord

我有一个我认为非常简单和经典的
mod_rewrite
用例,这让我很困惑

我的文件结构如下:

/var/www/site 
/var/www/site/webapp    <-- js application     
/var/www/site/index.php <-- php entry point
/var/www/site/.. other folders..
所需的功能是:

  • http://site.dev/
    从/webapp加载内容
  • http://site.dev/order/18
    重定向到index.php,从URI传递
    /order/18

如果您想在浏览器中提供某种东西,那么它必须是任何类型的HTML,如果它来自/webapp中的文件(例如index.HTML或index.php),或者它是由/var/www/site/?@Webdesigner中的/index.php文件处理的,前端应用程序的静态内容是从/webapp中提供的,例如index.HTML,js_lib.js等。如果您想在浏览器中提供某种东西,那么它必须是任何类型的HTML,它是来自/webapp中的文件(例如index.HTML或index.php),还是由/var/www/site/?@Webdesigner中的/index.php文件处理,前端应用程序的静态内容是从/webapp中提供的,例如index.HTML、js_lib.js等。
<VirtualHost *:80>
        ServerName site.dev

        ServerAdmin me@localhost
        DocumentRoot /var/www/site/

        LogLevel core:debug

        ErrorLog ${APACHE_LOG_DIR}/site.error.log

    <Location />
        RewriteEngine On
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^ /index.php [QSA,L]
    </Location>
</VirtualHost>