与网站子文件夹不同的文件夹
我需要一些有关 URL 重写的帮助。情况与这个类似。
我有一个正在运行的 Zend Framework 站点。现在我必须在 Wordpress 中添加一个博客(也可以工作)。我选择不沉迷于ZF控制器/动作/路线制定;我看过一些关于此的教程,我认为它们对于“简单”重定向来说太多了。现在,关于“重定向”...
它应该是这样的:
www.site.com
(指向/var/www/zf
)www.site.com/blog
(指向/var/www/wp
)
我知道我应该停止 www.site.com/blog
进入ZF 的内部结构,我目前正在做这个RewriteRule ^blog - [NC,L]
在其 .htaccess 中,但仅此而已。正如@jason所说,“只需将其传递到Wordpress”,但我不知道具体该怎么做。
相关问题:
我从未尝试过,但是 Apache 在两个不同的虚拟主机中支持此功能吗?服务器名称 www.site.com
(ZF 站点的虚拟主机)服务器名称 www.site.com/blog
(WP 网站的虚拟主机)
I need some help with URL rewriting. The case is similar with this one.
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"...
This is how it should look like:
www.site.com
(points to/var/www/zf
)www.site.com/blog
(points to/var/www/wp
)
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.
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)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
实现此目的的最简单方法,您希望子 URL 指向外部VirtualHost 的 DocumentRoot 目录,用于创建别名...
在 VirtualHost 块内添加:
*这假设您以某种方式为该目录启用了 PHP。
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...
Inside the VirtualHost block add:
*This assumes you have PHP enabled in some way for that directory.
ServerName 技巧不起作用:ServerName 指令中不能包含路径名。
对于 mod_rewrite 你应该能够摆脱这样的事情:
The ServerName trick will not work: you can not have path names in a ServerName directive.
For mod_rewrite you should be able to get away with something like this: