2010-04-22 119 views
3

我在一个帐户上托管多个域,我目前有一个RewriteRule设置为将根URL(www.root.com)重定向到子目录(/ public_html/root /)。htaccess从子域重定向到根

但是,我想从根网址(www.root.com/xyz)访问根目录(/ public_html/xyz /)中的几个目录。是否可以为此写入重定向,还是必须将这些文件夹放在/ public_html/root /目录中?

这是我对的.htaccess

RewriteEngine on 
RewriteCond %{HTTP_HOST} ^(www.)?root.com$ 
RewriteCond %{REQUEST_URI} !^/root/ 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 

RewriteCond %{HTTP_HOST} ^(www.)?root.com$ 
RewriteRule ^(/)?$ root/index.php [L] 

提前感谢!

+1

不客气。 – Ben 2010-04-22 19:45:34

+0

选民结束:这个问题很好。请参阅http://meta.stackexchange.com/questions/39063/mod-rewrite-questions-getting-migrated-to-sf – 2010-04-22 20:08:22

回答

0

这听起来像一个简单的Alias工作。

试试这个在您的域的VirtualHost

Alias /xyz/ /public_html/xyz/ 
+0

如果我将其添加到我的htaccess文件,它将返回500内部服务器错误。你有什么建议来解决这个问题? – Erin 2010-04-23 19:39:34

+0

@Erin错误日志说什么? – 2010-04-23 20:17:07

+0

@Erin你的别名是什么样子的? – 2010-04-23 20:32:18