htaccess 跨域内部重写?

发布于 2024-09-08 04:09:33 字数 710 浏览 1 评论 0原文

我试图将一个子文件夹从一个域指向我的虚拟主机(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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

水波映月 2024-09-15 04:09:33

据我所知,跨虚拟主机域实现重写的唯一方法是使用域之间的符号链接来欺骗 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

送舟行 2024-09-15 04:09:33

您正在做的内部重写。

对于 301 重定向,您必须编写 [L,R=301]:

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/blog/
RewriteRule ^(.*)$ http://www.mydomain.com/wpmu/clientdomain/$1 [L,R=301]

What you are doing is an internal rewrite.

For a 301 redirect you would have to write [L,R=301]:

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/blog/
RewriteRule ^(.*)$ http://www.mydomain.com/wpmu/clientdomain/$1 [L,R=301]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文