2009-06-29 119 views
1

我有我的整个项目目录document_root我需要在那里重定向。如何用htaccess更改基本目录

我做了简单的重写规则

RewriteEngine on 
RewriteRule ^(.*)$ document_root/$1 [L] 

,如果我有

http://someurl.com/?foo=bar 

但是当我做

http://someurl.com/index.php?foo=bar 

然后将其重定向到这工作就好了document_root版本,所以url看起来像

http://someurl.com/document_root/index.php?foo=bar 

我想避免。

是否还有任何方式如何阻止document_root版本并将其发送回较短的url版本?

回答

1
RewriteEngine on 
RewriteCond %{SCRIPT_FILENAME} !.*/index.php$ 
RewriteRule ^(.*)$ document_root/$1 [L]