子域通配符htaccess的重定向到新的域名 [英] Subdomain wildcard htaccess redirection to new domain

查看:133
本文介绍了子域通配符htaccess的重定向到新的域名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的一个网站,我想重定向Ø另一个域。

One of my websites I want to redirect o another domain.

情况:

[老] * .example.com的 [新] * .example.net

[old] *.example.com [new] *.example.net

现在我有这个在我的htaccess

for now I have this in my htaccess

#RewriteCond %{HTTP_HOST} ^(.*).allwebsitestats.com [NC]
#RewriteRule ^(.*)$ http://$1.allwebsitestats.nl [R=301,L]

该操作的结果;

The result of this;

请求[老] * .example.com的在[新] .example.net,问题是结果 它不会通配符子域吧。

Request [old] *.example.com results in [new] .example.net, the problem is it doesn't get the wildcard subdomain with it.

谢谢你!

问候, 尼克

推荐答案

的httpd.conf 启用了mod_rewrite和.htaccess,然后把这个code在< $ C C>的.htaccess $ DOCUMENT_ROOT 目录下:

Enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} ^(.+?)\.allwebsitestats\.com$ [NC]
RewriteRule ^ http://%1.allwebsitestats.nl%{REQUEST_URI} [R=301,L]

这篇关于子域通配符htaccess的重定向到新的域名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆