重定向* .exapmle.com / foo / bar?moo = soo到exapmle.net/foo/bar?moo=soo

时间:2012-02-01 21:24:23

标签: apache .htaccess redirect

我希望将所有请求重定向到

*.exapmle.com/foo/bar?moo=soo TO exapmle.net/foo/bar?moo=soo

例如

www.exapmle.com/foo/bar?moo=soo TO exapmle.net/foo/bar?moo=soo

exapmle.com/foo/bar?moo=soo TO exapmle.net/foo/bar?moo=soo

如何处理htaceess文件?

1 个答案:

答案 0 :(得分:0)

  

我如何将[wildcard] .exapmle.com / [wildcard2]重定向到example.net/ [wildcard2],例如s1.example.com/content/1?from=test到example.net/content/1?from =测试

将以下内容添加到exapmle.com网站根目录中的.htaccess文件

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST}  exapmle\.com$ [NC]
RewriteRule ^  http://exapmle.net%{REQUEST_URI} [L,R=301]