由网友(在记忆里流浪)分享简介:我有两个领域:www.example1.com/ --> IP=1.2.3.4www.example2.com/ --> IP=1.2.3.4 (same IP for both domains)我想要去 www.example2.com / *所有请求来访问请求的网页。我想要去 www.example1.com...
我有两个领域:
www.example1.com/ --> IP=1.2.3.4
www.example2.com/ --> IP=1.2.3.4 (same IP for both domains)
我想要去 www.example2.com / *所有请求
来访问请求的网页。
我想要去 www.example1.com / *
来重定向到 www.example2.com / *
所有的请求。我怎么会做这样的阿帕奇?正如现在我正在做这在JavaScript。
I want all requests that go to www.example2.com/*
to access the requested page.
I want all requests that go to www.example1.com/*
to redirect to www.example2.com/*
. How would I do this in apache? As now I am currently doing this in javascript.
推荐答案
把这个code在 DOCUMENT_ROOT /的.htaccess
文件:
put this code in your DOCUMENT_ROOT/.htaccess
file:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?example1.com [NC]
RewriteRule ^ http://www.example2.com%{REQUEST_URI} [NE,R=301,L]
相关推荐
最新文章