与网站子文件夹不同的文件夹 [英] Different folder as website subfolder
问题描述
我需要一些 URL 重写方面的帮助.这种情况与这个类似.
I need some help with URL rewriting. The case is similar with this one.
我有一个可用的 Zend Framework 站点.现在我必须在 Wordpress 中添加一个博客(也可以工作).我选择不沉迷于 ZF 控制器-/动作-/路由制作;我已经看过一些关于这个的教程,我认为它们对于普通"重定向来说太过分了.现在,关于重定向"...
I have a working Zend Framework site. Now I must add a blog in Wordpress (also working). I've chosen not to indulge in ZF controller-/action-/route-making; I've seen a couple of tutorials about this and I consider them too much for a "plain" redirection. Now, about that "redirection"...
它应该是这样的:
www.site.com
(指向/var/www/zf
)www.site.com/blog
(指向/var/www/wp
)
www.site.com
(points to/var/www/zf
)www.site.com/blog
(points to/var/www/wp
)
我知道我应该停止 www.site.com/blog
进入 ZF 的内部,我目前正在使用 RewriteRule ^blog - [NC,L]
在其 .htaccess 中,仅此而已.正如 @jason 所说,只需将其传递给 Wordpress",但我不知道该怎么做.
I know that I should stop www.site.com/blog
to enter ZF's innards and I'm currently doing this with RewriteRule ^blog - [NC,L]
in its .htaccess, but that's about it. As @jason said, "just pass it through to Wordpress", but I don't know how exactly to do that.
相关问题:
我从未尝试过,但是 Apache 是否在 两个不同的 vhost 中支持此功能?ServerName www.site.com
(ZF 站点的虚拟主机)ServerName www.site.com/blog
(WP 站点的虚拟主机)
Related question:
I never tried it, but does Apache support this in two different vhosts?
ServerName www.site.com
(vhost for ZF site)
ServerName www.site.com/blog
(vhost for WP site)
推荐答案
www.site.com(指向/var/www/zf)
www.site.com (points to /var/www/zf)
www.site.com/blog(指向/var/www/wp)
www.site.com/blog (points to /var/www/wp)
实现这一点的最简单方法是创建一个别名...
The easiset way to achive this, where you want a sub-url to point outside the VirtualHost's DocumentRoot directory, is to create an Alias...
在 VirtualHost 块内添加:
Inside the VirtualHost block add:
Alias /blog /var/www/wp
<Directory /var/www/wp>
Options All
AllowOverride All
order allow,deny
allow from all
</Directory>
*这假设您以某种方式为该目录启用了 PHP.
*This assumes you have PHP enabled in some way for that directory.
这篇关于与网站子文件夹不同的文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!