从urlhtaccess apache中删除目录

我有网站所有的文件都在public_html根,所以我的url是http://foo.com/index.php

我已经把我所有的文件移动到一个酒吧目录,所以现在的url是: http://foo.com/bar/index.php : http://foo.com/bar/index.php但是我想重写的url,使目录栏不显示在url和该网站仍然显示为http://foo.com/index.php 。 什么是实现这个最好的方法? 我有LAMP托pipe,可以更改htaccess文件。

提前致谢。

把这个代码放在你的.htaccess下public_html:

 Options +FollowSymLinks -MultiViews # Turn mod_rewrite on RewriteEngine On RewriteBase / RewriteRule ^((?!bar/).*)$ bar/$1 [NC,L] 

然后你可以访问你的网站http://foo.com/index.php