不同目录的不同重写条件和文档根

时间:2009-10-07 16:06:35

标签: apache

我目前在httpd.conf中有以下网站设置:

<VirtualHost x.x.x.x:80>
 ServerName testsite
 ExpiresActive On
 ExpiresByType image/gif A2592000
 ExpiresByType image/png A2592000
 ExpiresByType image/jpg A2592000
 ExpiresByType image/jpeg A2592000
 ExpiresByType text/css A2592000
 ExpiresByType application/x-javascript A1
 ExpiresByType text/javascript A1
 AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript text/javascript

 DocumentRoot /usr/local/www/apache22/data/thesite/trunk

 RewriteEngine On
 RewriteRule !\.(htc|js|tiff|gif|css|jpg|png|swf|ico|jar|html|doc|pdf|htm|xml)$ %{DOCUMENT_ROOT}/../platform.php [L]
</VirtualHost>

x.x.x.x是我的IP。

目前它将任何不在集合中的内容(htc | js | tiff | gif | css | jpg | png | swf | ico | jar | html | doc | pdf | htm | xml)转发给platform.php

htp://x.x.x.x/phpmyadmin如何转发。如果我在子目录中,是否可以仅执行此重写conidtion。例如。 http://x.x.x.x/projectone 所以htp://x.x.x.x/projectone/login将指向platform.php

谢谢

1 个答案:

答案 0 :(得分:0)

尝试此规则:

RewriteCond %{REQUEST_URI} !\.(htc|js|tiff|gif|css|jpg|png|swf|ico|jar|html|doc|pdf|htm|xml)$
RewriteRule ^projectone(/|$) %{DOCUMENT_ROOT}/platform.php [L]