htaccess 跨域内部重写?
我试图将一个子文件夹从一个域指向我的虚拟主机(mediatemple)上的另一个域。我想使用内部重写,而不是 301 重定向。目标如下
http://www.clientdomain.com/blog/$1 --> http://www.mydomain.com/wpmu/clientdomain/$1
在服务器端,结构如下所示:
/x/y/z/domains/clientdomain.com/html/blog/ -- htaccess file is here
/x/y/z/domains/mydomain.com/html/wpmu/ -- wpmu installation
到目前为止,我仅成功实现了 301 重定向,但我的目标是屏蔽一些内容,以便 wpmu 可以为客户端的博客提供支持,而无需透露其位置。这是我的工作 301 重定向:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/blog/
RewriteRule ^(.*)$ http://www.mydomain.com/wpmu/clientdomain/$1 [NC]
是否有一种简单的方法将其转换为内部重写?除了 301 重定向之外,我没有看到任何此类事情...
提前致谢,
Casey
I'm trying to point a subfolder from one domain to another on my vhost (mediatemple). I want to use internal rewrites, not 301 redirects. Here's the goal
http://www.clientdomain.com/blog/$1 --> http://www.mydomain.com/wpmu/clientdomain/$1
On the server side, the structure looks like this:
/x/y/z/domains/clientdomain.com/html/blog/ -- htaccess file is here
/x/y/z/domains/mydomain.com/html/wpmu/ -- wpmu installation
So far I've only had success with 301 redirects, but my goal is to mask things such that wpmu can power the client's blog without revealing its location. Here's my working 301 redirect:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/blog/
RewriteRule ^(.*)$ http://www.mydomain.com/wpmu/clientdomain/$1 [NC]
Is there an easy way to convert it to an internal rewrite? I haven't seen anything but 301 redirects for this type of thing...
Thanks in advance,
Casey
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
据我所知,跨虚拟主机域实现重写的唯一方法是使用域之间的符号链接来欺骗 mod_rewrite 认为它正在进行内部重写
From what I can tell, the only way to achieve this rewrite across vhosted domains is to use a symbolic link between domains to fool mod_rewrite into thinking it's doing an internal rewrite
您正在做的是内部重写。
对于 301 重定向,您必须编写 [L,R=301]:
What you are doing is an internal rewrite.
For a 301 redirect you would have to write [L,R=301]: