.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..
所需的功能是:
从/webapp加载内容http://site.dev/
重定向到index.php,从URI传递http://site.dev/order/18
/order/18
<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>